Browse Source

Corrected constraint locations.

newNRvisualizers
Mike Krüger 15 years ago
parent
commit
3303c99160
  1. 19
      ICSharpCode.NRefactory.CSharp/Parser/CSharpParser.cs

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

@ -374,8 +374,8 @@ namespace ICSharpCode.NRefactory.CSharp
AddTypeParameters (newType, typeArgLocation, c.MemberName.TypeArguments); AddTypeParameters (newType, typeArgLocation, c.MemberName.TypeArguments);
if (typeArgLocation != null) if (typeArgLocation != null)
newType.AddChild (new CSharpTokenNode (Convert (typeArgLocation[1]), 1), TypeDeclaration.Roles.RChevron); newType.AddChild (new CSharpTokenNode (Convert (typeArgLocation[1]), 1), TypeDeclaration.Roles.RChevron);
AddConstraints (newType, c);
} }
if (c.TypeBaseExpressions != null) { if (c.TypeBaseExpressions != null) {
if (location != null && curLoc < location.Count) if (location != null && curLoc < location.Count)
newType.AddChild (new CSharpTokenNode (Convert (location[curLoc++]), 1), AstNode.Roles.Colon); newType.AddChild (new CSharpTokenNode (Convert (location[curLoc++]), 1), AstNode.Roles.Colon);
@ -390,6 +390,8 @@ namespace ICSharpCode.NRefactory.CSharp
} }
} }
} }
AddConstraints (newType, c);
if (location != null && curLoc < location.Count) if (location != null && curLoc < location.Count)
newType.AddChild (new CSharpTokenNode (Convert (location[curLoc++]), 1), AstNode.Roles.LBrace); newType.AddChild (new CSharpTokenNode (Convert (location[curLoc++]), 1), AstNode.Roles.LBrace);
typeStack.Push (newType); typeStack.Push (newType);
@ -426,7 +428,6 @@ namespace ICSharpCode.NRefactory.CSharp
AddTypeParameters (newType, typeArgLocation, s.MemberName.TypeArguments); AddTypeParameters (newType, typeArgLocation, s.MemberName.TypeArguments);
if (typeArgLocation != null) if (typeArgLocation != null)
newType.AddChild (new CSharpTokenNode (Convert (typeArgLocation[1]), 1), TypeDeclaration.Roles.RChevron); newType.AddChild (new CSharpTokenNode (Convert (typeArgLocation[1]), 1), TypeDeclaration.Roles.RChevron);
AddConstraints (newType, s);
} }
if (s.TypeBaseExpressions != null) { if (s.TypeBaseExpressions != null) {
@ -443,6 +444,7 @@ namespace ICSharpCode.NRefactory.CSharp
} }
} }
AddConstraints (newType, s);
if (location != null && curLoc < location.Count) if (location != null && curLoc < location.Count)
newType.AddChild (new CSharpTokenNode (Convert (location[curLoc++]), 1), AstNode.Roles.LBrace); newType.AddChild (new CSharpTokenNode (Convert (location[curLoc++]), 1), AstNode.Roles.LBrace);
typeStack.Push (newType); typeStack.Push (newType);
@ -478,8 +480,8 @@ namespace ICSharpCode.NRefactory.CSharp
AddTypeParameters (newType, typeArgLocation, i.MemberName.TypeArguments); AddTypeParameters (newType, typeArgLocation, i.MemberName.TypeArguments);
if (typeArgLocation != null) if (typeArgLocation != null)
newType.AddChild (new CSharpTokenNode (Convert (typeArgLocation[1]), 1), MemberReferenceExpression.Roles.RChevron); newType.AddChild (new CSharpTokenNode (Convert (typeArgLocation[1]), 1), MemberReferenceExpression.Roles.RChevron);
AddConstraints (newType, i);
} }
if (i.TypeBaseExpressions != null) { if (i.TypeBaseExpressions != null) {
if (location != null && curLoc < location.Count) if (location != null && curLoc < location.Count)
newType.AddChild (new CSharpTokenNode (Convert (location[curLoc++]), 1), AstNode.Roles.Colon); newType.AddChild (new CSharpTokenNode (Convert (location[curLoc++]), 1), AstNode.Roles.Colon);
@ -493,6 +495,8 @@ namespace ICSharpCode.NRefactory.CSharp
} }
} }
} }
AddConstraints (newType, i);
if (location != null && curLoc < location.Count) if (location != null && curLoc < location.Count)
newType.AddChild (new CSharpTokenNode (Convert (location[curLoc++]), 1), AstNode.Roles.LBrace); newType.AddChild (new CSharpTokenNode (Convert (location[curLoc++]), 1), AstNode.Roles.LBrace);
typeStack.Push (newType); typeStack.Push (newType);
@ -527,7 +531,7 @@ namespace ICSharpCode.NRefactory.CSharp
AddTypeParameters (newDelegate, typeArgLocation, d.MemberName.TypeArguments); AddTypeParameters (newDelegate, typeArgLocation, d.MemberName.TypeArguments);
if (typeArgLocation != null) if (typeArgLocation != null)
newDelegate.AddChild (new CSharpTokenNode (Convert (typeArgLocation[1]), 1), TypeDeclaration.Roles.RChevron); newDelegate.AddChild (new CSharpTokenNode (Convert (typeArgLocation[1]), 1), TypeDeclaration.Roles.RChevron);
AddConstraints (newDelegate, d);
} }
if (location != null) if (location != null)
newDelegate.AddChild (new CSharpTokenNode (Convert (location[1]), 1), DelegateDeclaration.Roles.LPar); newDelegate.AddChild (new CSharpTokenNode (Convert (location[1]), 1), DelegateDeclaration.Roles.LPar);
@ -535,6 +539,9 @@ namespace ICSharpCode.NRefactory.CSharp
if (location != null) { if (location != null) {
newDelegate.AddChild (new CSharpTokenNode (Convert (location[2]), 1), DelegateDeclaration.Roles.RPar); newDelegate.AddChild (new CSharpTokenNode (Convert (location[2]), 1), DelegateDeclaration.Roles.RPar);
}
AddConstraints (newDelegate, d);
if (location != null) {
newDelegate.AddChild (new CSharpTokenNode (Convert (location[3]), 1), DelegateDeclaration.Roles.Semicolon); newDelegate.AddChild (new CSharpTokenNode (Convert (location[3]), 1), DelegateDeclaration.Roles.Semicolon);
} }
AddType (newDelegate); AddType (newDelegate);
@ -889,7 +896,6 @@ namespace ICSharpCode.NRefactory.CSharp
AddTypeParameters (newMethod, typeArgLocation, m.MemberName.TypeArguments); AddTypeParameters (newMethod, typeArgLocation, m.MemberName.TypeArguments);
if (typeArgLocation != null) if (typeArgLocation != null)
newMethod.AddChild (new CSharpTokenNode (Convert (typeArgLocation[1]), 1), MemberReferenceExpression.Roles.RChevron); newMethod.AddChild (new CSharpTokenNode (Convert (typeArgLocation[1]), 1), MemberReferenceExpression.Roles.RChevron);
AddConstraints (newMethod, m.GenericMethod);
} }
if (location != null) if (location != null)
@ -898,6 +904,9 @@ namespace ICSharpCode.NRefactory.CSharp
if (location != null) if (location != null)
newMethod.AddChild (new CSharpTokenNode (Convert (location[1]), 1), MethodDeclaration.Roles.RPar); newMethod.AddChild (new CSharpTokenNode (Convert (location[1]), 1), MethodDeclaration.Roles.RPar);
AddConstraints (newMethod, m.GenericMethod);
if (m.Block != null) { if (m.Block != null) {
var bodyBlock = (BlockStatement)m.Block.Accept (this); var bodyBlock = (BlockStatement)m.Block.Accept (this);
// if (m.Block is ToplevelBlock) { // if (m.Block is ToplevelBlock) {

Loading…
Cancel
Save