Browse Source

Updated mcs/fixes some unit tests.

newNRvisualizers
Mike Krüger 14 years ago
parent
commit
c0b97ae07e
  1. 7506
      ICSharpCode.NRefactory.CSharp/Parser/mcs/cs-parser.cs
  2. 20
      ICSharpCode.NRefactory.CSharp/Parser/mcs/cs-parser.jay
  3. 2
      ICSharpCode.NRefactory.CSharp/Parser/mcs/cs-tokenizer.cs
  4. 6
      ICSharpCode.NRefactory.CSharp/Parser/mcs/enum.cs
  5. 9
      ICSharpCode.NRefactory.CSharp/Parser/mcs/visit.cs
  6. 4
      ICSharpCode.NRefactory.Tests/CSharp/Parser/Bugs/ParserBugTests.cs

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

File diff suppressed because it is too large Load Diff

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

@ -2570,7 +2570,7 @@ enum_declaration @@ -2570,7 +2570,7 @@ enum_declaration
report.Error (1675, name.Location, "Enums cannot have type parameters");
}
push_current_container (new Enum (current_container, (TypeExpression) $5, (Modifiers) $2, name, (Attributes) $1), null);
push_current_container (new Enum (current_container, (FullNamedExpression) $5, (Modifiers) $2, name, (Attributes) $1), null);
if ($5 != null) {
lbag.AddMember (current_container, GetModifierLocations (), GetLocation ($3), savedLocation, GetLocation ($7));
} else {
@ -2605,14 +2605,8 @@ opt_enum_base @@ -2605,14 +2605,8 @@ opt_enum_base
: /* empty */
| COLON type
{
var te = $2 as TypeExpression;
savedLocation = GetLocation ($1);
if (te == null || !EnumSpec.IsValidUnderlyingType (te.Type)) {
Enum.Error_1008 (GetLocation ($2), report);
$$ = $2;
} else {
$$ = $2;
}
$$ = $2;
}
| COLON error
{
@ -4117,6 +4111,11 @@ conditional_expression @@ -4117,6 +4111,11 @@ conditional_expression
$$ = new Conditional (new BooleanExpression ((Expression) $1), (Expression) $3, (Expression) $5, GetLocation ($2));
lbag.AddLocation ($$, GetLocation ($4));
}
| null_coalescing_expression INTERR expression error
{
Error_SyntaxError (yyToken);
$$ = new Conditional (new BooleanExpression ((Expression) $1), (Expression) $3, null, GetLocation ($2));
}
;
assignment_expression
@ -5309,6 +5308,11 @@ switch_label @@ -5309,6 +5308,11 @@ switch_label
$$ = new SwitchLabel ((Expression) $2, GetLocation ($1));
lbag.AddLocation ($$, GetLocation ($3));
}
| CASE constant_expression error
{
Error_SyntaxError (yyToken);
$$ = new SwitchLabel ((Expression) $2, GetLocation ($1));
}
| DEFAULT_COLON
{
$$ = new SwitchLabel (null, GetLocation ($1));

2
ICSharpCode.NRefactory.CSharp/Parser/mcs/cs-tokenizer.cs

@ -1304,7 +1304,7 @@ namespace Mono.CSharp @@ -1304,7 +1304,7 @@ namespace Mono.CSharp
}
}
next_token = colons != interrs ? Token.INTERR_NULLABLE : Token.INTERR;
next_token = colons != interrs && braces == 0 ? Token.INTERR_NULLABLE : Token.INTERR;
break;
}
}

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

@ -162,9 +162,9 @@ namespace Mono.CSharp { @@ -162,9 +162,9 @@ namespace Mono.CSharp {
Modifiers.INTERNAL |
Modifiers.PRIVATE;
readonly TypeExpr underlying_type_expr;
readonly FullNamedExpression underlying_type_expr;
public Enum (TypeContainer parent, TypeExpression type, Modifiers mod_flags, MemberName name, Attributes attrs)
public Enum (TypeContainer parent, FullNamedExpression type, Modifiers mod_flags, MemberName name, Attributes attrs)
: base (parent, name, attrs, MemberKind.Enum)
{
underlying_type_expr = type;
@ -181,7 +181,7 @@ namespace Mono.CSharp { @@ -181,7 +181,7 @@ namespace Mono.CSharp {
}
}
public TypeExpr BaseTypeExpression {
public FullNamedExpression BaseTypeExpression {
get {
return underlying_type_expr;
}

9
ICSharpCode.NRefactory.CSharp/Parser/mcs/visit.cs

@ -2,7 +2,7 @@ @@ -2,7 +2,7 @@
// visit.cs: Visitors for parsed dom
//
// Authors: Mike Krüger (mkrueger@novell.com)
// Marek Safar (marek.safar@gmail.com)
// Marek Safar (marek.safar@gmail.com)
//
// Dual licensed under the terms of the MIT X11 or GNU GPL
//
@ -26,16 +26,15 @@ namespace Mono.CSharp @@ -26,16 +26,15 @@ namespace Mono.CSharp
foreach (var container in mc.Containers) {
container.Accept (this);
}
}
void VisitTypeDefinition (TypeDefinition tc)
{
foreach (var container in tc.Members) {
container.Accept (this);
foreach (var member in tc.Members) {
member.Accept (this);
}
}
public virtual void Visit (NamespaceContainer ns)
{
}

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

@ -92,7 +92,6 @@ class Stub @@ -92,7 +92,6 @@ class Stub
/// <summary>
/// Bug 4058 - Unattached parameter attributes should be included in the AST
/// </summary>
[Ignore("Still open")]
[Test]
public void TestBug4058()
{
@ -107,7 +106,7 @@ class TestClass @@ -107,7 +106,7 @@ class TestClass
var type = unit.Members.First() as TypeDeclaration;
var constructor = type.Members.First() as ConstructorDeclaration;
bool passed = constructor.LParToken.NextSibling is AttributeSection;
bool passed = constructor.GetNodeAt<AttributeSection>(constructor.LParToken.StartLocation.Line, constructor.LParToken.StartLocation.Column + 1) != null;
if (!passed) {
Console.WriteLine("Expected:" + code);
Console.WriteLine("Was:" + unit.GetText());
@ -177,7 +176,6 @@ class Foo @@ -177,7 +176,6 @@ class Foo
/// <summary>
/// Bug 3517 - Incomplete conditional operator in the AST request.
/// </summary>
[Ignore("'expr' is in the AST, but cond not.")]
[Test]
public void TestBug3517()
{

Loading…
Cancel
Save