示例#1
0
 public static void AddAttributes(AbstractMember member, IList <CustomAttribute> attributes)
 {
     foreach (CustomAttribute customAttribute in attributes)
     {
         member.Add(new DomCecilAttribute(customAttribute));
     }
 }
 protected void Visit(IMember source, AbstractMember target, T data)
 {
     target.Name          = source.Name;
     target.Documentation = source.Documentation;
     target.Modifiers     = source.Modifiers;
     target.Location      = source.Location;
     target.BodyRegion    = source.BodyRegion;
     if (source.ReturnType != null)
     {
         target.ReturnType = (IReturnType)source.ReturnType.AcceptVisitor(this, data);
     }
     foreach (IReturnType rt in source.ExplicitInterfaces)
     {
         target.AddExplicitInterface((IReturnType)rt.AcceptVisitor(this, data));
     }
     foreach (IAttribute attr in source.Attributes)
     {
         target.Add((IAttribute)attr.AcceptVisitor(this, data));
     }
 }
示例#3
0
		public static void AddAttributes (AbstractMember member, IList<CustomAttribute> attributes)
		{
			foreach (CustomAttribute customAttribute in attributes) {
				member.Add (new DomCecilAttribute (customAttribute));
			}
		}
			static void AddExplicitInterfaces (AbstractMember member, IEnumerable<ICSharpCode.NRefactory.Ast.InterfaceImplementation> interfaceImplementations)
			{
				if (interfaceImplementations == null)
					return;

				foreach (ICSharpCode.NRefactory.Ast.InterfaceImplementation impl in interfaceImplementations) {
					member.AddExplicitInterface (ConvertReturnType (impl.InterfaceType));
				}
			}
			static void AddAttributes (AbstractMember member, IEnumerable<ICSharpCode.NRefactory.Ast.AttributeSection> attributes)
			{
				CodeDomVisitor domVisitor = new CodeDomVisitor ();
				foreach (ICSharpCode.NRefactory.Ast.AttributeSection attributeSection in attributes) {
					foreach (ICSharpCode.NRefactory.Ast.Attribute attribute in attributeSection.Attributes) {
						DomAttribute domAttribute = new DomAttribute ();
						domAttribute.Name = attribute.Name;
						domAttribute.Region = ConvertRegion (attribute.StartLocation, attribute.EndLocation);
						domAttribute.AttributeType = new DomReturnType (attribute.Name);
						member.Add (domAttribute);
						foreach (ICSharpCode.NRefactory.Ast.Expression exp in attribute.PositionalArguments)
							domAttribute.AddPositionalArgument ((CodeExpression)exp.AcceptVisitor (domVisitor, null));
						foreach (ICSharpCode.NRefactory.Ast.NamedArgumentExpression nexp in attribute.NamedArguments)
							domAttribute.AddNamedArgument (nexp.Name, (CodeExpression)nexp.Expression.AcceptVisitor (domVisitor, null));
					}
				}
			}