|
|
|
@ -225,7 +225,7 @@ namespace ICSharpCode.NRefactory.CSharp |
|
|
|
var typeArgLocation = LocationsBag.GetLocations (c.MemberName); |
|
|
|
var typeArgLocation = LocationsBag.GetLocations (c.MemberName); |
|
|
|
if (typeArgLocation != null) |
|
|
|
if (typeArgLocation != null) |
|
|
|
newType.AddChild (new CSharpTokenNode (Convert (typeArgLocation[0]), 1), TypeDeclaration.Roles.LChevron); |
|
|
|
newType.AddChild (new CSharpTokenNode (Convert (typeArgLocation[0]), 1), TypeDeclaration.Roles.LChevron); |
|
|
|
// AddTypeArguments (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); |
|
|
|
AddConstraints (newType, c); |
|
|
|
@ -254,7 +254,7 @@ namespace ICSharpCode.NRefactory.CSharp |
|
|
|
var typeArgLocation = LocationsBag.GetLocations (s.MemberName); |
|
|
|
var typeArgLocation = LocationsBag.GetLocations (s.MemberName); |
|
|
|
if (typeArgLocation != null) |
|
|
|
if (typeArgLocation != null) |
|
|
|
newType.AddChild (new CSharpTokenNode (Convert (typeArgLocation[0]), 1), TypeDeclaration.Roles.LChevron); |
|
|
|
newType.AddChild (new CSharpTokenNode (Convert (typeArgLocation[0]), 1), TypeDeclaration.Roles.LChevron); |
|
|
|
// AddTypeArguments (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); |
|
|
|
AddConstraints (newType, s); |
|
|
|
@ -283,7 +283,7 @@ namespace ICSharpCode.NRefactory.CSharp |
|
|
|
var typeArgLocation = LocationsBag.GetLocations (i.MemberName); |
|
|
|
var typeArgLocation = LocationsBag.GetLocations (i.MemberName); |
|
|
|
if (typeArgLocation != null) |
|
|
|
if (typeArgLocation != null) |
|
|
|
newType.AddChild (new CSharpTokenNode (Convert (typeArgLocation[0]), 1), MemberReferenceExpression.Roles.LChevron); |
|
|
|
newType.AddChild (new CSharpTokenNode (Convert (typeArgLocation[0]), 1), MemberReferenceExpression.Roles.LChevron); |
|
|
|
// AddTypeArguments (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); |
|
|
|
AddConstraints (newType, i); |
|
|
|
@ -307,12 +307,12 @@ namespace ICSharpCode.NRefactory.CSharp |
|
|
|
if (location != null) |
|
|
|
if (location != null) |
|
|
|
newDelegate.AddChild (new CSharpTokenNode (Convert (location[0]), "delegate".Length), TypeDeclaration.Roles.Keyword); |
|
|
|
newDelegate.AddChild (new CSharpTokenNode (Convert (location[0]), "delegate".Length), TypeDeclaration.Roles.Keyword); |
|
|
|
newDelegate.AddChild (ConvertToType (d.ReturnType), AstNode.Roles.Type); |
|
|
|
newDelegate.AddChild (ConvertToType (d.ReturnType), AstNode.Roles.Type); |
|
|
|
newDelegate.AddChild (new Identifier (d.Name, Convert (d.MemberName.Location)), AstNode.Roles.Identifier); |
|
|
|
newDelegate.AddChild (new Identifier (d.Basename, Convert (d.MemberName.Location)), AstNode.Roles.Identifier); |
|
|
|
if (d.MemberName.TypeArguments != null) { |
|
|
|
if (d.MemberName.TypeArguments != null) { |
|
|
|
var typeArgLocation = LocationsBag.GetLocations (d.MemberName); |
|
|
|
var typeArgLocation = LocationsBag.GetLocations (d.MemberName); |
|
|
|
if (typeArgLocation != null) |
|
|
|
if (typeArgLocation != null) |
|
|
|
newDelegate.AddChild (new CSharpTokenNode (Convert (typeArgLocation[0]), 1), TypeDeclaration.Roles.LChevron); |
|
|
|
newDelegate.AddChild (new CSharpTokenNode (Convert (typeArgLocation[0]), 1), TypeDeclaration.Roles.LChevron); |
|
|
|
// AddTypeArguments (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); |
|
|
|
AddConstraints (newDelegate, d); |
|
|
|
@ -632,7 +632,7 @@ namespace ICSharpCode.NRefactory.CSharp |
|
|
|
var typeArgLocation = LocationsBag.GetLocations (m.MemberName); |
|
|
|
var typeArgLocation = LocationsBag.GetLocations (m.MemberName); |
|
|
|
if (typeArgLocation != null) |
|
|
|
if (typeArgLocation != null) |
|
|
|
newMethod.AddChild (new CSharpTokenNode (Convert (typeArgLocation[0]), 1), MemberReferenceExpression.Roles.LChevron); |
|
|
|
newMethod.AddChild (new CSharpTokenNode (Convert (typeArgLocation[0]), 1), MemberReferenceExpression.Roles.LChevron); |
|
|
|
// AddTypeArguments (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); |
|
|
|
|
|
|
|
|
|
|
|
@ -1835,17 +1835,22 @@ namespace ICSharpCode.NRefactory.CSharp |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void AddTypeArguments (AstNode parent, LocationsBag.MemberLocations location, Mono.CSharp.TypeArguments typeArguments) |
|
|
|
void AddTypeParameters (AstNode parent, List<Location> location, Mono.CSharp.TypeArguments typeArguments) |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (typeArguments == null || typeArguments.IsEmpty) |
|
|
|
if (typeArguments == null || typeArguments.IsEmpty) |
|
|
|
return; |
|
|
|
return; |
|
|
|
for (int i = 0; i < typeArguments.Count; i++) { |
|
|
|
for (int i = 0; i < typeArguments.Count; i++) { |
|
|
|
if (location != null && i > 0 && i - 1 < location.Count) |
|
|
|
if (location != null && i > 0 && i - 1 < location.Count) |
|
|
|
parent.AddChild (new CSharpTokenNode (Convert (location[i - 1]), 1), InvocationExpression.Roles.Comma); |
|
|
|
parent.AddChild (new CSharpTokenNode (Convert (location[i - 1]), 1), InvocationExpression.Roles.Comma); |
|
|
|
var arg = typeArguments.Args[i]; |
|
|
|
var arg = (TypeParameterName)typeArguments.Args[i]; |
|
|
|
if (arg == null) |
|
|
|
if (arg == null) |
|
|
|
continue; |
|
|
|
continue; |
|
|
|
parent.AddChild (ConvertToType (arg), InvocationExpression.Roles.TypeArgument); |
|
|
|
TypeParameterDeclaration tp = new TypeParameterDeclaration(); |
|
|
|
|
|
|
|
// TODO: attributes
|
|
|
|
|
|
|
|
if (arg.Variance != Variance.None) |
|
|
|
|
|
|
|
throw new NotImplementedException(); // TODO: variance
|
|
|
|
|
|
|
|
tp.AddChild (new Identifier (arg.Name, Convert (arg.Location)), InvocationExpression.Roles.Identifier); |
|
|
|
|
|
|
|
parent.AddChild (tp, InvocationExpression.Roles.TypeParameter); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@ -1871,11 +1876,12 @@ namespace ICSharpCode.NRefactory.CSharp |
|
|
|
Constraints c = d.Constraints[i]; |
|
|
|
Constraints c = d.Constraints[i]; |
|
|
|
var location = LocationsBag.GetLocations (c); |
|
|
|
var location = LocationsBag.GetLocations (c); |
|
|
|
var constraint = new Constraint (); |
|
|
|
var constraint = new Constraint (); |
|
|
|
parent.AddChild (new CSharpTokenNode (Convert (location[0]), "where".Length), InvocationExpression.Roles.Keyword); |
|
|
|
constraint.AddChild (new CSharpTokenNode (Convert (location[0]), "where".Length), InvocationExpression.Roles.Keyword); |
|
|
|
parent.AddChild (new Identifier (c.TypeParameter.Value, Convert (c.TypeParameter.Location)), InvocationExpression.Roles.Identifier); |
|
|
|
constraint.AddChild (new Identifier (c.TypeParameter.Value, Convert (c.TypeParameter.Location)), InvocationExpression.Roles.Identifier); |
|
|
|
parent.AddChild (new CSharpTokenNode (Convert (location[1]), 1), Constraint.ColonRole); |
|
|
|
constraint.AddChild (new CSharpTokenNode (Convert (location[1]), 1), Constraint.ColonRole); |
|
|
|
foreach (var expr in c.ConstraintExpressions) |
|
|
|
foreach (var expr in c.ConstraintExpressions) |
|
|
|
parent.AddChild (ConvertToType (expr), Constraint.BaseTypeRole); |
|
|
|
constraint.AddChild (ConvertToType (expr), Constraint.BaseTypeRole); |
|
|
|
|
|
|
|
parent.AddChild (constraint, AstNode.Roles.Constraint); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|