2 // attribute.cs: Attribute Handler
\r
4 // Author: Ravi Pratap (ravi@ximian.com)
\r
6 // Licensed under the terms of the GNU GPL
\r
8 // (C) 2001 Ximian, Inc (http://www.ximian.com)
\r
13 using System.Diagnostics;
\r
14 using System.Collections;
\r
15 using System.Reflection;
\r
16 using System.Reflection.Emit;
\r
17 using System.Runtime.InteropServices;
\r
18 using System.Runtime.CompilerServices;
\r
21 namespace Mono.CSharp {
\r
23 public class Attribute {
\r
24 public readonly string Name;
\r
25 public readonly ArrayList Arguments;
\r
32 // The following are only meaningful when the attribute
\r
33 // being emitted is one of the builtin ones
\r
35 AttributeTargets Targets;
\r
39 bool UsageAttr = false;
\r
41 MethodImplOptions ImplOptions;
\r
42 UnmanagedType UnmanagedType;
\r
43 CustomAttributeBuilder cb;
\r
45 public Attribute (string name, ArrayList args, Location loc)
\r
52 void Error_InvalidNamedArgument (string name)
\r
54 Report.Error (617, Location, "'" + name + "' is not a valid named attribute " +
\r
55 "argument. Named attribute arguments must be fields which are not " +
\r
56 "readonly, static or const, or properties with a set accessor which "+
\r
60 void Error_AttributeArgumentNotValid ()
\r
62 Report.Error (182, Location,
\r
63 "An attribute argument must be a constant expression, typeof " +
\r
64 "expression or array creation expression");
\r
67 static void Error_AttributeConstructorMismatch (Location loc)
\r
71 "Could not find a constructor for this argument list.");
\r
74 private Type CheckAttributeType (EmitContext ec) {
\r
76 bool isattributeclass = true;
\r
78 t = RootContext.LookupType (ec.DeclSpace, Name, true, Location);
\r
80 isattributeclass = t.IsSubclassOf (TypeManager.attribute_type);
\r
81 if (isattributeclass)
\r
84 t = RootContext.LookupType (ec.DeclSpace, Name + "Attribute", true, Location);
\r
86 if (t.IsSubclassOf (TypeManager.attribute_type))
\r
89 if (!isattributeclass) {
\r
90 Report.Error (616, Location, "'" + Name + "': is not an attribute class");
\r
94 Report.Error (616, Location, "'" + Name + "Attribute': is not an attribute class");
\r
98 246, Location, "Could not find attribute '" + Name + "' (are you" +
\r
99 " missing a using directive or an assembly reference ?)");
\r
103 public Type ResolveType (EmitContext ec)
\r
105 Type = CheckAttributeType (ec);
\r
110 public CustomAttributeBuilder Resolve (EmitContext ec)
\r
113 Type = CheckAttributeType (ec);
\r
117 bool MethodImplAttr = false;
\r
118 bool MarshalAsAttr = false;
\r
122 if (Type == TypeManager.attribute_usage_type)
\r
124 if (Type == TypeManager.methodimpl_attr_type)
\r
125 MethodImplAttr = true;
\r
126 if (Type == TypeManager.marshal_as_attr_type)
\r
127 MarshalAsAttr = true;
\r
129 // Now we extract the positional and named arguments
\r
131 ArrayList pos_args = new ArrayList ();
\r
132 ArrayList named_args = new ArrayList ();
\r
133 int pos_arg_count = 0;
\r
135 if (Arguments != null) {
\r
136 pos_args = (ArrayList) Arguments [0];
\r
137 if (pos_args != null)
\r
138 pos_arg_count = pos_args.Count;
\r
139 if (Arguments.Count > 1)
\r
140 named_args = (ArrayList) Arguments [1];
\r
143 object [] pos_values = new object [pos_arg_count];
\r
146 // First process positional arguments
\r
150 for (i = 0; i < pos_arg_count; i++) {
\r
151 Argument a = (Argument) pos_args [i];
\r
154 if (!a.Resolve (ec, Location))
\r
158 if (e is Constant) {
\r
159 pos_values [i] = ((Constant) e).GetValue ();
\r
160 } else if (e is TypeOf) {
\r
161 pos_values [i] = ((TypeOf) e).TypeArg;
\r
163 Error_AttributeArgumentNotValid ();
\r
168 this.Targets = (AttributeTargets) pos_values [0];
\r
170 if (MethodImplAttr)
\r
171 this.ImplOptions = (MethodImplOptions) pos_values [0];
\r
174 this.UnmanagedType =
\r
175 (System.Runtime.InteropServices.UnmanagedType) pos_values [0];
\r
179 // Now process named arguments
\r
182 ArrayList field_infos = new ArrayList ();
\r
183 ArrayList prop_infos = new ArrayList ();
\r
184 ArrayList field_values = new ArrayList ();
\r
185 ArrayList prop_values = new ArrayList ();
\r
187 for (i = 0; i < named_args.Count; i++) {
\r
188 DictionaryEntry de = (DictionaryEntry) named_args [i];
\r
189 string member_name = (string) de.Key;
\r
190 Argument a = (Argument) de.Value;
\r
193 if (!a.Resolve (ec, Location))
\r
196 Expression member = Expression.MemberLookup (
\r
197 ec, Type, member_name,
\r
198 MemberTypes.Field | MemberTypes.Property,
\r
199 BindingFlags.Public | BindingFlags.Instance,
\r
202 if (member == null || !(member is PropertyExpr || member is FieldExpr)) {
\r
203 Error_InvalidNamedArgument (member_name);
\r
208 if (member is PropertyExpr) {
\r
209 PropertyExpr pe = (PropertyExpr) member;
\r
210 PropertyInfo pi = pe.PropertyInfo;
\r
212 if (!pi.CanWrite) {
\r
213 Error_InvalidNamedArgument (member_name);
\r
217 if (e is Constant) {
\r
218 object o = ((Constant) e).GetValue ();
\r
219 prop_values.Add (o);
\r
222 if (member_name == "AllowMultiple")
\r
223 this.AllowMultiple = (bool) o;
\r
224 if (member_name == "Inherited")
\r
225 this.Inherited = (bool) o;
\r
229 Error_AttributeArgumentNotValid ();
\r
233 prop_infos.Add (pi);
\r
235 } else if (member is FieldExpr) {
\r
236 FieldExpr fe = (FieldExpr) member;
\r
237 FieldInfo fi = fe.FieldInfo;
\r
239 if (fi.IsInitOnly) {
\r
240 Error_InvalidNamedArgument (member_name);
\r
245 // Handle charset here, and set the TypeAttributes
\r
247 if (e is Constant){
\r
248 object value = ((Constant) e).GetValue ();
\r
250 field_values.Add (value);
\r
252 Error_AttributeArgumentNotValid ();
\r
256 field_infos.Add (fi);
\r
260 Expression mg = Expression.MemberLookup (
\r
261 ec, Type, ".ctor", MemberTypes.Constructor,
\r
262 BindingFlags.Public | BindingFlags.Instance, Location);
\r
265 Error_AttributeConstructorMismatch (Location);
\r
269 MethodBase constructor = Invocation.OverloadResolve (
\r
270 ec, (MethodGroupExpr) mg, pos_args, Location);
\r
272 if (constructor == null) {
\r
273 Error_AttributeConstructorMismatch (Location);
\r
277 PropertyInfo [] prop_info_arr = new PropertyInfo [prop_infos.Count];
\r
278 FieldInfo [] field_info_arr = new FieldInfo [field_infos.Count];
\r
279 object [] field_values_arr = new object [field_values.Count];
\r
280 object [] prop_values_arr = new object [prop_values.Count];
\r
282 field_infos.CopyTo (field_info_arr, 0);
\r
283 field_values.CopyTo (field_values_arr, 0);
\r
285 prop_values.CopyTo (prop_values_arr, 0);
\r
286 prop_infos.CopyTo (prop_info_arr, 0);
\r
289 cb = new CustomAttributeBuilder (
\r
290 (ConstructorInfo) constructor, pos_values,
\r
291 prop_info_arr, prop_values_arr,
\r
292 field_info_arr, field_values_arr);
\r
293 } catch (NullReferenceException) {
\r
296 "The compiler can not encode this attribute in the Mono runtime\n" +
\r
297 "\tdue to a known bug in it. We know about the problem and will\n" +
\r
298 "\tfix it as soon as possible.");
\r
302 // using System.ComponentModel;
\r
303 // [DefaultValue (CollectionChangeAction.Add)]
\r
304 // class X { static void Main () {} }
\r
308 "The compiler can not encode this attribute in .NET due to\n" +
\r
309 "\ta bug in the .NET runtime. Try the Mono runtime");
\r
315 static string GetValidPlaces (Attribute attr)
\r
317 StringBuilder sb = new StringBuilder ();
\r
318 AttributeTargets targets = 0;
\r
320 TypeContainer a = TypeManager.LookupAttr (attr.Type);
\r
324 System.Attribute [] attrs = null;
\r
327 attrs = System.Attribute.GetCustomAttributes (attr.Type);
\r
330 Report.Error (-20, attr.Location, "Cannot find attribute type " + attr.Name +
\r
331 " (maybe you forgot to set the usage using the" +
\r
332 " AttributeUsage attribute ?).");
\r
336 foreach (System.Attribute tmp in attrs)
\r
337 if (tmp is AttributeUsageAttribute) {
\r
338 targets = ((AttributeUsageAttribute) tmp).ValidOn;
\r
342 targets = a.Targets;
\r
345 if ((targets & AttributeTargets.Assembly) != 0)
\r
346 sb.Append ("'assembly' ");
\r
348 if ((targets & AttributeTargets.Class) != 0)
\r
349 sb.Append ("'class' ");
\r
351 if ((targets & AttributeTargets.Constructor) != 0)
\r
352 sb.Append ("'constructor' ");
\r
354 if ((targets & AttributeTargets.Delegate) != 0)
\r
355 sb.Append ("'delegate' ");
\r
357 if ((targets & AttributeTargets.Enum) != 0)
\r
358 sb.Append ("'enum' ");
\r
360 if ((targets & AttributeTargets.Event) != 0)
\r
361 sb.Append ("'event' ");
\r
363 if ((targets & AttributeTargets.Field) != 0)
\r
364 sb.Append ("'field' ");
\r
366 if ((targets & AttributeTargets.Interface) != 0)
\r
367 sb.Append ("'interface' ");
\r
369 if ((targets & AttributeTargets.Method) != 0)
\r
370 sb.Append ("'method' ");
\r
372 if ((targets & AttributeTargets.Module) != 0)
\r
373 sb.Append ("'module' ");
\r
375 if ((targets & AttributeTargets.Parameter) != 0)
\r
376 sb.Append ("'parameter' ");
\r
378 if ((targets & AttributeTargets.Property) != 0)
\r
379 sb.Append ("'property' ");
\r
381 if ((targets & AttributeTargets.ReturnValue) != 0)
\r
382 sb.Append ("'return value' ");
\r
384 if ((targets & AttributeTargets.Struct) != 0)
\r
385 sb.Append ("'struct' ");
\r
387 return sb.ToString ();
\r
391 public static void Error_AttributeNotValidForElement (Attribute a, Location loc)
\r
394 592, loc, "Attribute '" + a.Name +
\r
395 "' is not valid on this declaration type. " +
\r
396 "It is valid on " + GetValidPlaces (a) + "declarations only.");
\r
399 public static bool CheckAttribute (Attribute a, object element)
\r
401 TypeContainer attr = TypeManager.LookupAttr (a.Type);
\r
402 AttributeTargets targets = 0;
\r
405 if (attr == null) {
\r
407 System.Attribute [] attrs = null;
\r
410 attrs = System.Attribute.GetCustomAttributes (a.Type);
\r
413 Report.Error (-20, a.Location, "Cannot find attribute type " + a.Name +
\r
414 " (maybe you forgot to set the usage using the" +
\r
415 " AttributeUsage attribute ?).");
\r
419 foreach (System.Attribute tmp in attrs)
\r
420 if (tmp is AttributeUsageAttribute)
\r
421 targets = ((AttributeUsageAttribute) tmp).ValidOn;
\r
423 targets = attr.Targets;
\r
425 if (element is Class) {
\r
426 if ((targets & AttributeTargets.Class) != 0)
\r
431 } else if (element is Struct) {
\r
432 if ((targets & AttributeTargets.Struct) != 0)
\r
436 } else if (element is Constructor) {
\r
437 if ((targets & AttributeTargets.Constructor) != 0)
\r
441 } else if (element is Delegate) {
\r
442 if ((targets & AttributeTargets.Delegate) != 0)
\r
446 } else if (element is Enum) {
\r
447 if ((targets & AttributeTargets.Enum) != 0)
\r
451 } else if (element is Event || element is InterfaceEvent) {
\r
452 if ((targets & AttributeTargets.Event) != 0)
\r
456 } else if (element is Field || element is FieldBuilder) {
\r
457 if ((targets & AttributeTargets.Field) != 0)
\r
461 } else if (element is Interface) {
\r
462 if ((targets & AttributeTargets.Interface) != 0)
\r
466 } else if (element is Method || element is Operator || element is InterfaceMethod || element is Accessor) {
\r
467 if ((targets & AttributeTargets.Method) != 0)
\r
471 } else if (element is ParameterBuilder) {
\r
472 if ((targets & AttributeTargets.Parameter) != 0)
\r
476 } else if (element is Property || element is Indexer ||
\r
477 element is InterfaceProperty || element is InterfaceIndexer) {
\r
478 if ((targets & AttributeTargets.Property) != 0)
\r
482 } else if (element is AssemblyBuilder){
\r
483 if ((targets & AttributeTargets.Assembly) != 0)
\r
493 // This method should be invoked to pull the IndexerName attribute from an
\r
494 // Indexer if it exists.
\r
496 public static string ScanForIndexerName (EmitContext ec, Attributes opt_attrs)
\r
498 if (opt_attrs == null)
\r
500 if (opt_attrs.AttributeSections == null)
\r
503 foreach (AttributeSection asec in opt_attrs.AttributeSections) {
\r
504 if (asec.Attributes == null)
\r
507 foreach (Attribute a in asec.Attributes){
\r
508 if (a.ResolveType (ec) == null)
\r
511 if (a.Type != TypeManager.indexer_name_type)
\r
515 // So we have found an IndexerName, pull the data out.
\r
517 if (a.Arguments == null || a.Arguments [0] == null){
\r
518 Error_AttributeConstructorMismatch (a.Location);
\r
521 ArrayList pos_args = (ArrayList) a.Arguments [0];
\r
522 if (pos_args.Count == 0){
\r
523 Error_AttributeConstructorMismatch (a.Location);
\r
527 Argument arg = (Argument) pos_args [0];
\r
528 if (!arg.Resolve (ec, a.Location))
\r
531 Expression e = arg.Expr;
\r
532 if (!(e is StringConstant)){
\r
533 Error_AttributeConstructorMismatch (a.Location);
\r
538 // Remove the attribute from the list
\r
540 asec.Attributes.Remove (a);
\r
542 return (((StringConstant) e).Value);
\r
549 // This pulls the condition name out of a Conditional attribute
\r
551 public string Conditional_GetConditionName ()
\r
554 // So we have a Conditional, pull the data out.
\r
556 if (Arguments == null || Arguments [0] == null){
\r
557 Error_AttributeConstructorMismatch (Location);
\r
561 ArrayList pos_args = (ArrayList) Arguments [0];
\r
562 if (pos_args.Count != 1){
\r
563 Error_AttributeConstructorMismatch (Location);
\r
567 Argument arg = (Argument) pos_args [0];
\r
568 if (!(arg.Expr is StringConstant)){
\r
569 Error_AttributeConstructorMismatch (Location);
\r
573 return ((StringConstant) arg.Expr).Value;
\r
577 // This pulls the obsolete message and error flag out of an Obsolete attribute
\r
579 public string Obsolete_GetObsoleteMessage (out bool is_error)
\r
583 // So we have an Obsolete, pull the data out.
\r
585 if (Arguments == null || Arguments [0] == null)
\r
588 ArrayList pos_args = (ArrayList) Arguments [0];
\r
589 if (pos_args.Count == 0)
\r
591 else if (pos_args.Count > 2){
\r
592 Error_AttributeConstructorMismatch (Location);
\r
596 Argument arg = (Argument) pos_args [0];
\r
597 if (!(arg.Expr is StringConstant)){
\r
598 Error_AttributeConstructorMismatch (Location);
\r
602 if (pos_args.Count == 2){
\r
603 Argument arg2 = (Argument) pos_args [1];
\r
604 if (!(arg2.Expr is BoolConstant)){
\r
605 Error_AttributeConstructorMismatch (Location);
\r
608 is_error = ((BoolConstant) arg2.Expr).Value;
\r
611 return ((StringConstant) arg.Expr).Value;
\r
615 // Applies the attributes to the `builder'.
\r
617 public static void ApplyAttributes (EmitContext ec, object builder, object kind,
\r
618 Attributes opt_attrs, Location loc)
\r
620 if (opt_attrs == null)
\r
622 if (opt_attrs.AttributeSections == null)
\r
625 foreach (AttributeSection asec in opt_attrs.AttributeSections) {
\r
626 if (asec.Attributes == null)
\r
629 if (asec.Target == "assembly" && !(builder is AssemblyBuilder))
\r
632 foreach (Attribute a in asec.Attributes) {
\r
633 CustomAttributeBuilder cb = a.Resolve (ec);
\r
638 if (!(kind is TypeContainer))
\r
639 if (!CheckAttribute (a, kind)) {
\r
640 Error_AttributeNotValidForElement (a, loc);
\r
644 if (kind is Method || kind is Operator || kind is InterfaceMethod ||
\r
645 kind is Accessor) {
\r
646 if (a.Type == TypeManager.methodimpl_attr_type) {
\r
647 if (a.ImplOptions == MethodImplOptions.InternalCall)
\r
648 ((MethodBuilder) builder).
\r
649 SetImplementationFlags (
\r
650 MethodImplAttributes.InternalCall |
\r
651 MethodImplAttributes.Runtime);
\r
652 } else if (a.Type != TypeManager.dllimport_type){
\r
653 ((MethodBuilder) builder).SetCustomAttribute (cb);
\r
655 } else if (kind is Constructor) {
\r
656 ((ConstructorBuilder) builder).SetCustomAttribute (cb);
\r
657 } else if (kind is Field) {
\r
658 ((FieldBuilder) builder).SetCustomAttribute (cb);
\r
659 } else if (kind is Property || kind is Indexer ||
\r
660 kind is InterfaceProperty || kind is InterfaceIndexer) {
\r
661 ((PropertyBuilder) builder).SetCustomAttribute (cb);
\r
662 } else if (kind is Event || kind is InterfaceEvent) {
\r
663 ((MyEventBuilder) builder).SetCustomAttribute (cb);
\r
664 } else if (kind is ParameterBuilder) {
\r
666 if (a.Type == TypeManager.marshal_as_attr_type) {
\r
667 UnmanagedMarshal marshal =
\r
668 UnmanagedMarshal.DefineUnmanagedMarshal (a.UnmanagedType);
\r
670 ((ParameterBuilder) builder).SetMarshal (marshal);
\r
672 ((ParameterBuilder) builder).SetCustomAttribute (cb);
\r
674 } else if (kind is Enum) {
\r
675 ((TypeBuilder) builder).SetCustomAttribute (cb);
\r
677 } else if (kind is TypeContainer) {
\r
678 TypeContainer tc = (TypeContainer) kind;
\r
681 tc.Targets = a.Targets;
\r
682 tc.AllowMultiple = a.AllowMultiple;
\r
683 tc.Inherited = a.Inherited;
\r
685 } else if (a.Type == TypeManager.default_member_type) {
\r
686 if (tc.Indexers != null) {
\r
687 Report.Error (646, loc,
\r
688 "Cannot specify the DefaultMember attribute on" +
\r
689 " a type containing an indexer");
\r
694 if (!CheckAttribute (a, kind)) {
\r
695 Error_AttributeNotValidForElement (a, loc);
\r
701 ((TypeBuilder) builder).SetCustomAttribute (cb);
\r
702 } catch (System.ArgumentException) {
\r
705 "The CharSet named property on StructLayout\n"+
\r
706 "\tdoes not work correctly on Microsoft.NET\n"+
\r
707 "\tYou might want to remove the CharSet declaration\n"+
\r
708 "\tor compile using the Mono runtime instead of the\n"+
\r
709 "\tMicrosoft .NET runtime");
\r
712 } else if (kind is Interface) {
\r
713 Interface iface = (Interface) kind;
\r
715 if ((a.Type == TypeManager.default_member_type) &&
\r
716 (iface.InterfaceIndexers != null)) {
\r
719 "Cannot specify the DefaultMember attribute on" +
\r
720 " a type containing an indexer");
\r
724 if (!CheckAttribute (a, kind)) {
\r
725 Error_AttributeNotValidForElement (a, loc);
\r
729 ((TypeBuilder) builder).SetCustomAttribute (cb);
\r
730 } else if (kind is AssemblyBuilder){
\r
731 ((AssemblyBuilder) builder).SetCustomAttribute (cb);
\r
732 } else if (kind is ModuleBuilder) {
\r
733 ((ModuleBuilder) builder).SetCustomAttribute (cb);
\r
734 } else if (kind is FieldBuilder) {
\r
735 ((FieldBuilder) builder).SetCustomAttribute (cb);
\r
737 throw new Exception ("Unknown kind: " + kind);
\r
742 public MethodBuilder DefinePInvokeMethod (EmitContext ec, TypeBuilder builder, string name,
\r
743 MethodAttributes flags, Type ret_type, Type [] param_types)
\r
746 // We extract from the attribute the information we need
\r
749 if (Arguments == null) {
\r
750 Console.WriteLine ("Internal error : this is not supposed to happen !");
\r
754 Type = CheckAttributeType (ec);
\r
758 ArrayList named_args = new ArrayList ();
\r
760 ArrayList pos_args = (ArrayList) Arguments [0];
\r
761 if (Arguments.Count > 1)
\r
762 named_args = (ArrayList) Arguments [1];
\r
765 string dll_name = null;
\r
767 Argument tmp = (Argument) pos_args [0];
\r
769 if (!tmp.Resolve (ec, Location))
\r
772 if (tmp.Expr is Constant)
\r
773 dll_name = (string) ((Constant) tmp.Expr).GetValue ();
\r
775 Error_AttributeArgumentNotValid ();
\r
779 // Now we process the named arguments
\r
780 CallingConvention cc = CallingConvention.Winapi;
\r
781 CharSet charset = CharSet.Ansi;
\r
782 bool preserve_sig = true;
\r
783 bool exact_spelling = false;
\r
784 bool set_last_err = false;
\r
785 string entry_point = null;
\r
787 for (int i = 0; i < named_args.Count; i++) {
\r
789 DictionaryEntry de = (DictionaryEntry) named_args [i];
\r
791 string member_name = (string) de.Key;
\r
792 Argument a = (Argument) de.Value;
\r
794 if (!a.Resolve (ec, Location))
\r
797 Expression member = Expression.MemberLookup (
\r
798 ec, Type, member_name,
\r
799 MemberTypes.Field | MemberTypes.Property,
\r
800 BindingFlags.Public | BindingFlags.Instance,
\r
803 if (member == null || !(member is FieldExpr)) {
\r
804 Error_InvalidNamedArgument (member_name);
\r
808 if (member is FieldExpr) {
\r
809 FieldExpr fe = (FieldExpr) member;
\r
810 FieldInfo fi = fe.FieldInfo;
\r
812 if (fi.IsInitOnly) {
\r
813 Error_InvalidNamedArgument (member_name);
\r
817 if (a.Expr is Constant) {
\r
818 Constant c = (Constant) a.Expr;
\r
820 if (member_name == "CallingConvention")
\r
821 cc = (CallingConvention) c.GetValue ();
\r
822 else if (member_name == "CharSet")
\r
823 charset = (CharSet) c.GetValue ();
\r
824 else if (member_name == "EntryPoint")
\r
825 entry_point = (string) c.GetValue ();
\r
826 else if (member_name == "SetLastError")
\r
827 set_last_err = (bool) c.GetValue ();
\r
828 else if (member_name == "ExactSpelling")
\r
829 exact_spelling = (bool) c.GetValue ();
\r
830 else if (member_name == "PreserveSig")
\r
831 preserve_sig = (bool) c.GetValue ();
\r
833 Error_AttributeArgumentNotValid ();
\r
840 if (entry_point == null)
\r
841 entry_point = name;
\r
843 MethodBuilder mb = builder.DefinePInvokeMethod (
\r
844 name, dll_name, entry_point, flags | MethodAttributes.HideBySig,
\r
845 CallingConventions.Standard,
\r
852 mb.SetImplementationFlags (MethodImplAttributes.PreserveSig);
\r
859 public class AttributeSection {
\r
861 public readonly string Target;
\r
862 public readonly ArrayList Attributes;
\r
864 public AttributeSection (string target, ArrayList attrs)
\r
867 Attributes = attrs;
\r
872 public class Attributes {
\r
873 public ArrayList AttributeSections;
\r
874 public Location Location;
\r
876 public Attributes (AttributeSection a, Location loc)
\r
878 AttributeSections = new ArrayList ();
\r
879 AttributeSections.Add (a);
\r
883 public void AddAttribute (AttributeSection a)
\r
886 AttributeSections.Add (a);
\r