+ //\r
+ // This method should be invoked to pull the IndexerName attribute from an\r
+ // Indexer if it exists.\r
+ //\r
+ public static string ScanForIndexerName (EmitContext ec, Attributes opt_attrs)\r
+ {\r
+ if (opt_attrs == null)\r
+ return null;\r
+ if (opt_attrs.AttributeSections == null)\r
+ return null;\r
+\r
+ foreach (AttributeSection asec in opt_attrs.AttributeSections) {\r
+ if (asec.Attributes == null)\r
+ continue;\r
+\r
+ foreach (Attribute a in asec.Attributes){\r
+ if (a.ResolveType (ec) == null)\r
+ return null;\r
+ \r
+ if (a.Type != TypeManager.indexer_name_type)\r
+ continue;\r
+\r
+ //\r
+ // So we have found an IndexerName, pull the data out.\r
+ //\r
+ if (a.Arguments == null || a.Arguments [0] == null){\r
+ Error_AttributeConstructorMismatch (a.Location);\r
+ return null;\r
+ }\r
+ ArrayList pos_args = (ArrayList) a.Arguments [0];\r
+ if (pos_args.Count == 0){\r
+ Error_AttributeConstructorMismatch (a.Location);\r
+ return null;\r
+ }\r
+ \r
+ Argument arg = (Argument) pos_args [0];\r
+ if (!arg.Resolve (ec, a.Location))\r
+ return null;\r
+ \r
+ Expression e = arg.Expr;\r
+ if (!(e is StringConstant)){\r
+ Error_AttributeConstructorMismatch (a.Location);\r
+ return null;\r
+ }\r
+\r
+ //\r
+ // Remove the attribute from the list\r
+ //\r
+ asec.Attributes.Remove (a);\r
+\r
+ return (((StringConstant) e).Value);\r
+ }\r
+ }\r
+ return null;\r
+ }\r
+\r
+ //\r
+ // This pulls the condition name out of a Conditional attribute\r
+ //\r
+ public string Conditional_GetConditionName ()\r
+ {\r
+ //\r
+ // So we have a Conditional, pull the data out.\r
+ //\r
+ if (Arguments == null || Arguments [0] == null){\r
+ Error_AttributeConstructorMismatch (Location);\r
+ return null;\r
+ }\r
+\r
+ ArrayList pos_args = (ArrayList) Arguments [0];\r
+ if (pos_args.Count != 1){\r
+ Error_AttributeConstructorMismatch (Location);\r
+ return null;\r
+ }\r
+\r
+ Argument arg = (Argument) pos_args [0]; \r
+ if (!(arg.Expr is StringConstant)){\r
+ Error_AttributeConstructorMismatch (Location);\r
+ return null;\r
+ }\r
+\r
+ return ((StringConstant) arg.Expr).Value;\r
+ }\r
+\r
+ //\r
+ // This pulls the obsolete message and error flag out of an Obsolete attribute\r
+ //\r
+ public string Obsolete_GetObsoleteMessage (out bool is_error)\r
+ {\r
+ is_error = false;\r
+ //\r
+ // So we have an Obsolete, pull the data out.\r
+ //\r
+ if (Arguments == null || Arguments [0] == null)\r
+ return "";\r
+\r
+ ArrayList pos_args = (ArrayList) Arguments [0];\r
+ if (pos_args.Count == 0)\r
+ return "";\r
+ else if (pos_args.Count > 2){\r
+ Error_AttributeConstructorMismatch (Location);\r
+ return null;\r
+ }\r
+\r
+ Argument arg = (Argument) pos_args [0]; \r
+ if (!(arg.Expr is StringConstant)){\r
+ Error_AttributeConstructorMismatch (Location);\r
+ return null;\r
+ }\r
+\r
+ if (pos_args.Count == 2){\r
+ Argument arg2 = (Argument) pos_args [1];\r
+ if (!(arg2.Expr is BoolConstant)){\r
+ Error_AttributeConstructorMismatch (Location);\r
+ return null;\r
+ }\r
+ is_error = ((BoolConstant) arg2.Expr).Value;\r
+ }\r
+\r
+ return ((StringConstant) arg.Expr).Value;\r
+ }\r
+\r
+ //\r
+ // Applies the attributes to the `builder'.\r
+ //\r