Browse Source

Fixed bug in constraints parsing.

newNRvisualizers
Mike Krüger 15 years ago
parent
commit
3b486325c2
  1. 5
      ICSharpCode.NRefactory.CSharp/Ast/SimpleType.cs
  2. 2
      ICSharpCode.NRefactory.CSharp/Parser/CSharpParser.cs

5
ICSharpCode.NRefactory.CSharp/Ast/SimpleType.cs

@ -42,6 +42,11 @@ namespace ICSharpCode.NRefactory.CSharp
this.Identifier = identifier; this.Identifier = identifier;
} }
public SimpleType (Identifier identifier)
{
this.IdentifierToken = identifier;
}
public SimpleType(string identifier, TextLocation location) public SimpleType(string identifier, TextLocation location)
{ {
SetChildByRole (Roles.Identifier, CSharp.Identifier.Create (identifier, location)); SetChildByRole (Roles.Identifier, CSharp.Identifier.Create (identifier, location));

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

@ -2414,7 +2414,7 @@ namespace ICSharpCode.NRefactory.CSharp
var location = LocationsBag.GetLocations (c); var location = LocationsBag.GetLocations (c);
var constraint = new Constraint (); var constraint = new Constraint ();
constraint.AddChild (new CSharpTokenNode (Convert (c.Location), "where".Length), InvocationExpression.Roles.Keyword); constraint.AddChild (new CSharpTokenNode (Convert (c.Location), "where".Length), InvocationExpression.Roles.Keyword);
constraint.AddChild (Identifier.Create (c.TypeParameter.Value, Convert (c.TypeParameter.Location)), InvocationExpression.Roles.Identifier); constraint.AddChild (new SimpleType (Identifier.Create (c.TypeParameter.Value, Convert (c.TypeParameter.Location))), Constraint.BaseTypeRole);
if (location != null) if (location != null)
constraint.AddChild (new CSharpTokenNode (Convert (location [0]), 1), Constraint.ColonRole); constraint.AddChild (new CSharpTokenNode (Convert (location [0]), 1), Constraint.ColonRole);
var commaLocs = LocationsBag.GetLocations (c.ConstraintExpressions); var commaLocs = LocationsBag.GetLocations (c.ConstraintExpressions);

Loading…
Cancel
Save