Browse Source

Fixed method/operator semicolons.

newNRvisualizers
Mike Krüger 14 years ago
parent
commit
ea6e15c28d
  1. 17
      ICSharpCode.NRefactory.CSharp/Parser/CSharpParser.cs
  2. 1180
      ICSharpCode.NRefactory.CSharp/Parser/mcs/cs-parser.cs
  3. 8
      ICSharpCode.NRefactory.CSharp/Parser/mcs/cs-parser.jay

17
ICSharpCode.NRefactory.CSharp/Parser/CSharpParser.cs

@ -776,9 +776,12 @@ namespace ICSharpCode.NRefactory.CSharp @@ -776,9 +776,12 @@ namespace ICSharpCode.NRefactory.CSharp
if (location != null)
newOperator.AddChild (new CSharpTokenNode (Convert (location[3]), 1), OperatorDeclaration.Roles.RPar);
if (o.Block != null)
if (o.Block != null) {
newOperator.AddChild ((BlockStatement)o.Block.Accept (this), OperatorDeclaration.Roles.Body);
} else {
if (location != null && location.Count >= 5)
newOperator.AddChild (new CSharpTokenNode (Convert (location[4]), 1), MethodDeclaration.Roles.Semicolon);
}
typeStack.Peek ().AddChild (newOperator, TypeDeclaration.MemberRole);
}
@ -895,9 +898,13 @@ namespace ICSharpCode.NRefactory.CSharp @@ -895,9 +898,13 @@ namespace ICSharpCode.NRefactory.CSharp
// } else {
newMethod.AddChild (bodyBlock, MethodDeclaration.Roles.Body);
// }
} else if (location != null && location.Count < 3 && typeStack.Peek ().ClassType != ClassType.Interface) {
// parser error, set end node to max value.
newMethod.AddChild (new ErrorNode (), AstNode.Roles.Error);
} else if (location != null) {
if (location.Count < 3) {
// parser error, set end node to max value.
newMethod.AddChild (new ErrorNode (), AstNode.Roles.Error);
} else {
newMethod.AddChild (new CSharpTokenNode (Convert (location[2]), 1), MethodDeclaration.Roles.Semicolon);
}
}
typeStack.Peek ().AddChild (newMethod, TypeDeclaration.MemberRole);
}

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

File diff suppressed because it is too large Load Diff

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

@ -1266,6 +1266,7 @@ method_declaration @@ -1266,6 +1266,7 @@ method_declaration
method.Block = (ToplevelBlock) $3;
if (method.Block == null) {
lbag.AppendToMember (method, savedLocation); // semicolon
method.ParameterInfo.CheckParameters (method);
if ((method.ModFlags & Modifiers.ASYNC) != 0) {
@ -1421,7 +1422,7 @@ method_header @@ -1421,7 +1422,7 @@ method_header
method_body
: block
| SEMICOLON { $$ = null; }
| SEMICOLON { savedLocation = GetLocation ($1); $$ = null; }
;
opt_formal_parameter_list
@ -2049,6 +2050,9 @@ operator_declaration @@ -2049,6 +2050,9 @@ operator_declaration
current_container.AddOperator (op);
lbag.AddMember (op, GetModifierLocations (), lbag.GetLocations (decl));
if ($5 == null) { // Semicolon
lbag.AppendTo (op, savedLocation);
}
}
current_local_parameters = null;
@ -2057,7 +2061,7 @@ operator_declaration @@ -2057,7 +2061,7 @@ operator_declaration
operator_body
: block
| SEMICOLON { $$ = null; }
| SEMICOLON { savedLocation = GetLocation ($1); $$ = null; }
;
operator_type

Loading…
Cancel
Save