public AttributeUsageAttribute GetAttributeUsage (PredefinedAttribute pa) { throw new NotSupportedException (); }
public AttributeUsageAttribute GetAttributeUsage (PredefinedAttribute pa) { Attribute a = null; if (OptAttributes != null) { a = OptAttributes.Search (pa); } if (a == null) return null; return a.GetAttributeUsageAttribute (); }
public Attribute ResolveAssemblyAttribute (PredefinedAttribute a_type) { Attribute a = OptAttributes.Search ("assembly", a_type); if (a != null) { a.Resolve (); } return a; }
public AttributeUsageAttribute GetAttributeUsage (PredefinedAttribute pa) { if (cattrs == null) ReadAttributes (); return cattrs.AttributeUsage; }
public PredefinedAttributes () { ParamArray = new PredefinedAttribute ("System", "ParamArrayAttribute"); Out = new PredefinedAttribute ("System.Runtime.InteropServices", "OutAttribute"); Obsolete = new PredefinedAttribute ("System", "ObsoleteAttribute"); DllImport = new PredefinedAttribute ("System.Runtime.InteropServices", "DllImportAttribute"); MethodImpl = new PredefinedAttribute ("System.Runtime.CompilerServices", "MethodImplAttribute"); MarshalAs = new PredefinedAttribute ("System.Runtime.InteropServices", "MarshalAsAttribute"); In = new PredefinedAttribute ("System.Runtime.InteropServices", "InAttribute"); IndexerName = new PredefinedAttribute ("System.Runtime.CompilerServices", "IndexerNameAttribute"); Conditional = new PredefinedAttribute ("System.Diagnostics", "ConditionalAttribute"); CLSCompliant = new PredefinedAttribute ("System", "CLSCompliantAttribute"); Security = new PredefinedAttribute ("System.Security.Permissions", "SecurityAttribute"); Required = new PredefinedAttribute ("System.Runtime.CompilerServices", "RequiredAttributeAttribute"); Guid = new PredefinedAttribute ("System.Runtime.InteropServices", "GuidAttribute"); AssemblyCulture = new PredefinedAttribute ("System.Reflection", "AssemblyCultureAttribute"); AssemblyVersion = new PredefinedAttribute ("System.Reflection", "AssemblyVersionAttribute"); AssemblyAlgorithmId = new PredefinedAttribute ("System.Reflection", "AssemblyAlgorithmIdAttribute"); AssemblyFlags = new PredefinedAttribute ("System.Reflection", "AssemblyFlagsAttribute"); ComImport = new PredefinedAttribute ("System.Runtime.InteropServices", "ComImportAttribute"); CoClass = new PredefinedAttribute ("System.Runtime.InteropServices", "CoClassAttribute"); AttributeUsage = new PredefinedAttribute ("System", "AttributeUsageAttribute"); DefaultParameterValue = new PredefinedAttribute ("System.Runtime.InteropServices", "DefaultParameterValueAttribute"); OptionalParameter = new PredefinedAttribute ("System.Runtime.InteropServices", "OptionalAttribute"); DefaultCharset = new PredefinedAttribute ("System.Runtime.InteropServices", "DefaultCharSetAttribute"); TypeForwarder = new PredefinedAttribute ("System.Runtime.CompilerServices", "TypeForwardedToAttribute"); FixedBuffer = new PredefinedAttribute ("System.Runtime.CompilerServices", "FixedBufferAttribute"); CompilerGenerated = new PredefinedAttribute ("System.Runtime.CompilerServices", "CompilerGeneratedAttribute"); InternalsVisibleTo = new PredefinedAttribute ("System.Runtime.CompilerServices", "InternalsVisibleToAttribute"); RuntimeCompatibility = new PredefinedAttribute ("System.Runtime.CompilerServices", "RuntimeCompatibilityAttribute"); DebuggerHidden = new PredefinedAttribute ("System.Diagnostics", "DebuggerHiddenAttribute"); UnsafeValueType = new PredefinedAttribute ("System.Runtime.CompilerServices", "UnsafeValueTypeAttribute"); Extension = new PredefinedAttribute ("System.Runtime.CompilerServices", "ExtensionAttribute"); Dynamic = new PredefinedAttribute ("System.Runtime.CompilerServices", "DynamicAttribute"); DynamicTransform = new PredefinedAttribute ("System.Runtime.CompilerServices", "DynamicAttribute"); DefaultMember = new PredefinedAttribute ("System.Reflection", "DefaultMemberAttribute"); DecimalConstant = new PredefinedAttribute ("System.Runtime.CompilerServices", "DecimalConstantAttribute"); StructLayout = new PredefinedAttribute ("System.Runtime.InteropServices", "StructLayoutAttribute"); FieldOffset = new PredefinedAttribute ("System.Runtime.InteropServices", "FieldOffsetAttribute"); }
Attribute ResolveAttribute(PredefinedAttribute a_type) { Attribute a = OptAttributes.Search (a_type); if (a != null) { a.Resolve (); } return a; }
/// <summary> /// Returns all attributes of type 't'. Use it when attribute is AllowMultiple = true /// </summary> public Attribute[] SearchMulti (PredefinedAttribute t) { List<Attribute> ar = null; foreach (Attribute a in Attrs) { if (a.ResolveType () == t) { if (ar == null) ar = new List<Attribute> (Attrs.Count); ar.Add (a); } } return ar == null ? null : ar.ToArray (); }
public bool Contains (PredefinedAttribute t) { return Search (t) != null; }
public Attribute Search (PredefinedAttribute t) { foreach (Attribute a in Attrs) { if (a.ResolveType () == t) return a; } return null; }
/// <summary> /// It is called very early therefore can resolve only predefined attributes /// </summary> void ResolveGlobalAttributes () { if (OptAttributes == null) return; if (!OptAttributes.CheckTargets ()) return; // FIXME: Define is wrong as the type may not exist yet var DefaultCharSet_attr = new PredefinedAttribute (this, "System.Runtime.InteropServices", "DefaultCharSetAttribute"); DefaultCharSet_attr.Define (); Attribute a = ResolveModuleAttribute (DefaultCharSet_attr); if (a != null) { has_default_charset = true; DefaultCharSet = a.GetCharSetValue (); switch (DefaultCharSet) { case CharSet.Ansi: case CharSet.None: break; case CharSet.Auto: DefaultCharSetType = TypeAttributes.AutoClass; break; case CharSet.Unicode: DefaultCharSetType = TypeAttributes.UnicodeClass; break; default: Report.Error (1724, a.Location, "Value specified for the argument to `{0}' is not valid", DefaultCharSet_attr.GetSignatureForError ()); break; } } }
/// <summary> /// Returns all attributes of type 't'. Use it when attribute is AllowMultiple = true /// </summary> public Attribute[] SearchMulti (PredefinedAttribute t) { ArrayList ar = null; foreach (Attribute a in Attrs) { if (a.ResolveType () == t) { if (ar == null) ar = new ArrayList (); ar.Add (a); } } return ar == null ? null : ar.ToArray (typeof (Attribute)) as Attribute[]; }
public AttributeUsageAttribute GetAttributeUsage(PredefinedAttribute pa) { Attribute a = null; if (OptAttributes != null) { a = OptAttributes.Search (pa); } if (a == null) { if (BaseType != TypeManager.attribute_type) return BaseType.GetAttributeUsage (pa); return null; } return a.GetAttributeUsageAttribute (); }
public void EmitPredefined (PredefinedAttribute pa, Location loc) { if (builder != null) pa.EmitAttribute (builder, loc); }