Browse Source

Updated mcs.

newNRvisualizers
Mike Krüger 14 years ago
parent
commit
e499b7aa20
  1. 9415
      ICSharpCode.NRefactory.CSharp/Parser/mcs/cs-parser.cs
  2. 38
      ICSharpCode.NRefactory.CSharp/Parser/mcs/cs-parser.jay
  3. 6
      ICSharpCode.NRefactory.CSharp/Parser/mcs/ecore.cs
  4. 4
      ICSharpCode.NRefactory.CSharp/Parser/mcs/nullable.cs
  5. 4
      ICSharpCode.NRefactory.Tests/CSharp/Parser/Bugs/ParserBugTests.cs

9415
ICSharpCode.NRefactory.CSharp/Parser/mcs/cs-parser.cs

File diff suppressed because it is too large Load Diff

38
ICSharpCode.NRefactory.CSharp/Parser/mcs/cs-parser.jay

@ -1521,12 +1521,18 @@ fixed_parameter
$$ = new Parameter ((FullNamedExpression) $3, lt.Value, (Parameter.Modifier) $2, (Attributes) $1, lt.Location); $$ = new Parameter ((FullNamedExpression) $3, lt.Value, (Parameter.Modifier) $2, (Attributes) $1, lt.Location);
lbag.AddLocation ($$, parameterModifierLocation); lbag.AddLocation ($$, parameterModifierLocation);
} }
| attribute_sections error
{
Error_SyntaxError (yyToken);
Location l = GetLocation ($2);
$$ = new Parameter (null, null, Parameter.Modifier.NONE, (Attributes) $1, l);
}
| opt_attributes | opt_attributes
opt_parameter_modifier opt_parameter_modifier
parameter_type parameter_type
error error
{ {
Error_SyntaxError (yyToken); Error_SyntaxError (yyToken);
Location l = GetLocation ($4); Location l = GetLocation ($4);
$$ = new Parameter ((FullNamedExpression) $3, null, (Parameter.Modifier) $2, (Attributes) $1, l); $$ = new Parameter ((FullNamedExpression) $3, null, (Parameter.Modifier) $2, (Attributes) $1, l);
lbag.AddLocation ($$, parameterModifierLocation); lbag.AddLocation ($$, parameterModifierLocation);
@ -3325,10 +3331,10 @@ argument_list
lbag.AppendTo (list, GetLocation ($2)); lbag.AppendTo (list, GetLocation ($2));
$$ = list; $$ = list;
} }
| argument_list COMMA | argument_list COMMA error
{ {
report.Error (839, GetLocation ($2), "An argument is missing"); Error_SyntaxError (yyToken);
$$ = $1; $$ = $1;
} }
| COMMA error | COMMA error
{ {
@ -3385,10 +3391,12 @@ element_access
} }
| primary_expression OPEN_BRACKET_EXPR expression_list_arguments error | primary_expression OPEN_BRACKET_EXPR expression_list_arguments error
{ {
Error_SyntaxError (yyToken);
$$ = new ElementAccess ((Expression) $1, (Arguments) $3, GetLocation ($2)); $$ = new ElementAccess ((Expression) $1, (Arguments) $3, GetLocation ($2));
} }
| primary_expression OPEN_BRACKET_EXPR error | primary_expression OPEN_BRACKET_EXPR error
{ {
Error_SyntaxError (yyToken);
$$ = new ElementAccess ((Expression) $1, null, GetLocation ($2)); $$ = new ElementAccess ((Expression) $1, null, GetLocation ($2));
} }
; ;
@ -3529,8 +3537,9 @@ array_creation_expression
} }
| NEW new_expr_type error | NEW new_expr_type error
{ {
Error_SyntaxError (1526, yyToken, "Unexpected symbol"); Error_SyntaxError (yyToken);
$$ = new ArrayCreation ((FullNamedExpression) $2, null, GetLocation ($1)); // It can be any of new expression, create the most common one
$$ = new New ((FullNamedExpression) $2, null, GetLocation ($1));
} }
; ;
@ -5582,6 +5591,11 @@ continue_statement
$$ = new Continue (GetLocation ($1)); $$ = new Continue (GetLocation ($1));
lbag.AddStatement ($$, GetLocation ($2)); lbag.AddStatement ($$, GetLocation ($2));
} }
| CONTINUE error
{
Error_SyntaxError (yyToken);
$$ = new Continue (GetLocation ($1));
}
; ;
goto_statement goto_statement
@ -5609,6 +5623,11 @@ return_statement
$$ = new Return ((Expression) $2, GetLocation ($1)); $$ = new Return ((Expression) $2, GetLocation ($1));
lbag.AddStatement ($$, GetLocation ($3)); lbag.AddStatement ($$, GetLocation ($3));
} }
| RETURN error
{
Error_SyntaxError (yyToken);
$$ = new Return (null, GetLocation ($1));
}
; ;
throw_statement throw_statement
@ -5617,6 +5636,11 @@ throw_statement
$$ = new Throw ((Expression) $2, GetLocation ($1)); $$ = new Throw ((Expression) $2, GetLocation ($1));
lbag.AddStatement ($$, GetLocation ($3)); lbag.AddStatement ($$, GetLocation ($3));
} }
| THROW error
{
Error_SyntaxError (yyToken);
$$ = new Throw (null, GetLocation ($1));
}
; ;
yield_statement yield_statement
@ -6793,7 +6817,7 @@ public void parse ()
report.Error (-25, lexer.Location, "Parsing error"); report.Error (-25, lexer.Location, "Parsing error");
} else { } else {
// Used by compiler-tester to test internal errors // Used by compiler-tester to test internal errors
if (yacc_verbose_flag > 0) if (yacc_verbose_flag > 0 || e is FatalException)
throw; throw;
report.Error (589, lexer.Location, "Internal compiler error during parsing" + e); report.Error (589, lexer.Location, "Internal compiler error during parsing" + e);

6
ICSharpCode.NRefactory.CSharp/Parser/mcs/ecore.cs

@ -2496,6 +2496,12 @@ namespace Mono.CSharp {
ErrorIsInaccesible (rc, e.GetSignatureForError (), loc); ErrorIsInaccesible (rc, e.GetSignatureForError (), loc);
return e; return e;
} }
} else {
var me = MemberLookup (rc, false, rc.CurrentType, Name, Arity, restrictions & ~MemberLookupRestrictions.InvocableOnly, loc) as MemberExpr;
if (me != null) {
me.Error_UnexpectedKind (rc, me, "method group", me.KindName, loc);
return ErrorExpression.Instance;
}
} }
e = rc.LookupNamespaceOrType (Name, -System.Math.Max (1, Arity), LookupMode.Probing, loc); e = rc.LookupNamespaceOrType (Name, -System.Math.Max (1, Arity), LookupMode.Probing, loc);

4
ICSharpCode.NRefactory.CSharp/Parser/mcs/nullable.cs

@ -860,7 +860,7 @@ namespace Mono.CSharp.Nullable
if (lifted_type == null) if (lifted_type == null)
return null; return null;
if (left is UserCast || left is TypeCast) if (left is UserCast || left is EmptyCast || left is OpcodeCast)
left.Type = lifted_type; left.Type = lifted_type;
else else
left = EmptyCast.Create (left, lifted_type); left = EmptyCast.Create (left, lifted_type);
@ -875,7 +875,7 @@ namespace Mono.CSharp.Nullable
if (r is ReducedExpression) if (r is ReducedExpression)
r = ((ReducedExpression) r).OriginalExpression; r = ((ReducedExpression) r).OriginalExpression;
if (r is UserCast || r is TypeCast) if (r is UserCast || r is EmptyCast || r is OpcodeCast)
r.Type = lifted_type; r.Type = lifted_type;
else else
right = EmptyCast.Create (right, lifted_type); right = EmptyCast.Create (right, lifted_type);

4
ICSharpCode.NRefactory.Tests/CSharp/Parser/Bugs/ParserBugTests.cs

@ -67,7 +67,6 @@ class Foo
/// <summary> /// <summary>
/// Bug 4059 - Return statement without semicolon missing in the AST /// Bug 4059 - Return statement without semicolon missing in the AST
/// </summary> /// </summary>
[Ignore("Still open")]
[Test] [Test]
public void TestBug4059() public void TestBug4059()
{ {
@ -178,7 +177,7 @@ class Foo
/// <summary> /// <summary>
/// Bug 3517 - Incomplete conditional operator in the AST request. /// Bug 3517 - Incomplete conditional operator in the AST request.
/// </summary> /// </summary>
[Ignore("Still open")] [Ignore("'expr' is in the AST, but cond not.")]
[Test] [Test]
public void TestBug3517() public void TestBug3517()
{ {
@ -205,7 +204,6 @@ class Foo
Assert.IsTrue(passed); Assert.IsTrue(passed);
} }
[Ignore("Still open")]
[Test] [Test]
public void TestBug3517Case2() public void TestBug3517Case2()
{ {

Loading…
Cancel
Save