diff --git a/ICSharpCode.NRefactory.CSharp/Ast/TypeMembers/AttributedNode.cs b/ICSharpCode.NRefactory.CSharp/Ast/TypeMembers/AttributedNode.cs index f854c594a7..09617c0074 100644 --- a/ICSharpCode.NRefactory.CSharp/Ast/TypeMembers/AttributedNode.cs +++ b/ICSharpCode.NRefactory.CSharp/Ast/TypeMembers/AttributedNode.cs @@ -25,6 +25,7 @@ namespace ICSharpCode.NRefactory.CSharp public abstract class AttributedNode : AstNode { public static readonly Role AttributeRole = new Role("Attribute"); + public static readonly Role UnattachedAttributeRole = new Role("UnattachedAttribute"); public static readonly Role ModifierRole = new Role("Modifier"); public AstNodeCollection Attributes { diff --git a/ICSharpCode.NRefactory.CSharp/Parser/CSharpParser.cs b/ICSharpCode.NRefactory.CSharp/Parser/CSharpParser.cs index 7d8bacb1e6..eb5b8f19e4 100644 --- a/ICSharpCode.NRefactory.CSharp/Parser/CSharpParser.cs +++ b/ICSharpCode.NRefactory.CSharp/Parser/CSharpParser.cs @@ -106,7 +106,9 @@ namespace ICSharpCode.NRefactory.CSharp subContainer.Accept (this); } } - + if (nspace.UnattachedAttributes != null && nspace.UnattachedAttributes.Length > 0) + AddToNamespace (ConvertAttributeSection (nspace.UnattachedAttributes)); + if (nDecl != null) { if (loc != null && loc.Count > 2) nDecl.AddChild (new CSharpTokenNode (Convert (loc[2]), 1), NamespaceDeclaration.Roles.RBrace); @@ -251,7 +253,7 @@ namespace ICSharpCode.NRefactory.CSharp return new SimpleType ("unknown"); } - IEnumerable GetAttributes (List optAttributes) + IEnumerable GetAttributes (IEnumerable optAttributes) { if (optAttributes == null) yield break; @@ -307,7 +309,7 @@ namespace ICSharpCode.NRefactory.CSharp } } - AttributeSection ConvertAttributeSection (List optAttributes) + AttributeSection ConvertAttributeSection (IEnumerable optAttributes) { if (optAttributes == null) return null; @@ -356,6 +358,7 @@ namespace ICSharpCode.NRefactory.CSharp AddToNamespace (nDecl); namespaceStack.Push (nDecl); } + if (nspace.Usings != null) { foreach (var us in nspace.Usings) { us.Accept (this); @@ -368,6 +371,9 @@ namespace ICSharpCode.NRefactory.CSharp } } + if (nspace.UnattachedAttributes != null && nspace.UnattachedAttributes.Length > 0) + AddToNamespace (ConvertAttributeSection (nspace.UnattachedAttributes)); + if (nDecl != null) { if (loc != null && loc.Count > 2) nDecl.AddChild (new CSharpTokenNode (Convert (loc[2]), 1), NamespaceDeclaration.Roles.RBrace); @@ -510,6 +516,10 @@ namespace ICSharpCode.NRefactory.CSharp newType.AddChild (new CSharpTokenNode (Convert (location[curLoc++]), 1), AstNode.Roles.LBrace); typeStack.Push (newType); base.Visit (c); + + if (c.UnattachedAttributes != null && c.UnattachedAttributes.Length > 0) + newType.AddChild (ConvertAttributeSection (c.UnattachedAttributes), TypeDeclaration.UnattachedAttributeRole); + if (location != null && curLoc < location.Count) { newType.AddChild (new CSharpTokenNode (Convert (location[curLoc++]), 1), AstNode.Roles.RBrace); diff --git a/ICSharpCode.NRefactory.CSharp/TypeSystem/CSharpAttribute.cs b/ICSharpCode.NRefactory.CSharp/TypeSystem/CSharpAttribute.cs index d86c321a28..38b21c1de4 100644 --- a/ICSharpCode.NRefactory.CSharp/TypeSystem/CSharpAttribute.cs +++ b/ICSharpCode.NRefactory.CSharp/TypeSystem/CSharpAttribute.cs @@ -156,7 +156,7 @@ namespace ICSharpCode.NRefactory.CSharp.TypeSystem } else { namedArgs = new List>(); foreach (var pair in unresolved.namedArguments) { - IMember member = attributeType.GetMembers(m => (m.EntityType == EntityType.Fidyj.keld || m.EntityType == EntityType.Property) && m.Name == pair.Key).FirstOrDefault(); + IMember member = attributeType.GetMembers(m => (m.EntityType == EntityType.Field || m.EntityType == EntityType.Property) && m.Name == pair.Key).FirstOrDefault(); if (member != null) { ResolveResult val = pair.Value.Resolve(context); namedArgs.Add(new KeyValuePair(member, val)); @@ -257,5 +257,4 @@ namespace ICSharpCode.NRefactory.CSharp.TypeSystem } } */ -} -MarshalByRefObject ^ẑäp \ No newline at end of file +} \ No newline at end of file