Browse Source

Parameter AST Node Attributes

NRefactoryASTResolver.cs is now adding parameter [Attribute(s)] to AST
Node
pull/67/head
Dragan 13 years ago
parent
commit
982247e72a
  1. 18
      src/Main/ICSharpCode.SharpDevelop.Dom/Project/Src/NRefactoryResolver/NRefactoryASTConvertVisitor.cs

18
src/Main/ICSharpCode.SharpDevelop.Dom/Project/Src/NRefactoryResolver/NRefactoryASTConvertVisitor.cs

@ -251,7 +251,7 @@ namespace ICSharpCode.SharpDevelop.Dom.NRefactoryResolver
return base.VisitOptionDeclaration(optionDeclaration, data); return base.VisitOptionDeclaration(optionDeclaration, data);
} }
void ConvertAttributes(AST.AttributedNode from, AbstractEntity to) static void ConvertAttributes(AST.AttributedNode from, AbstractEntity to)
{ {
if (from.Attributes.Count == 0) { if (from.Attributes.Count == 0) {
to.Attributes = DefaultAttribute.EmptyAttributeList; to.Attributes = DefaultAttribute.EmptyAttributeList;
@ -267,7 +267,18 @@ namespace ICSharpCode.SharpDevelop.Dom.NRefactoryResolver
} }
} }
List<IAttribute> VisitAttributes(IList<AST.AttributeSection> attributes, ClassFinder context) static void ConvertAttributes(AST.ParameterDeclarationExpression from, DefaultParameter to, IClass c )
{
if (from.Attributes.Count == 0) {
to.Attributes = DefaultAttribute.EmptyAttributeList;
} else {
ICSharpCode.NRefactory.Location location = from.Attributes[0].StartLocation;
ClassFinder context = new ClassFinder(c, location.Line, location.Column);
to.Attributes = VisitAttributes(from.Attributes, context);
}
}
static List<IAttribute> VisitAttributes(IList<AST.AttributeSection> attributes, ClassFinder context)
{ {
// TODO Expressions??? // TODO Expressions???
List<IAttribute> result = new List<IAttribute>(); List<IAttribute> result = new List<IAttribute>();
@ -322,7 +333,7 @@ namespace ICSharpCode.SharpDevelop.Dom.NRefactoryResolver
result.Add(new DefaultAttribute(new AttributeReturnType(context, attribute.Name), result.Add(new DefaultAttribute(new AttributeReturnType(context, attribute.Name),
target, positionalArguments, namedArguments) target, positionalArguments, namedArguments)
{ {
CompilationUnit = cu, CompilationUnit = context.CallingClass.CompilationUnit,
Region = GetRegion(attribute.StartLocation, attribute.EndLocation) Region = GetRegion(attribute.StartLocation, attribute.EndLocation)
}); });
} }
@ -568,6 +579,7 @@ namespace ICSharpCode.SharpDevelop.Dom.NRefactoryResolver
IReturnType parType = CreateReturnType(par.TypeReference, method, currentClass, cu, TypeVisitor.ReturnTypeOptions.None); IReturnType parType = CreateReturnType(par.TypeReference, method, currentClass, cu, TypeVisitor.ReturnTypeOptions.None);
DefaultParameter p = new DefaultParameter(par.ParameterName, parType, GetRegion(par.StartLocation, par.EndLocation)); DefaultParameter p = new DefaultParameter(par.ParameterName, parType, GetRegion(par.StartLocation, par.EndLocation));
p.Modifiers = (ParameterModifiers)par.ParamModifier; p.Modifiers = (ParameterModifiers)par.ParamModifier;
ConvertAttributes ( par, p, currentClass );
return p; return p;
} }

Loading…
Cancel
Save