2002-12-19 Miguel de Icaza <miguel@ximian.com>
authorMiguel de Icaza <miguel@gnome.org>
Thu, 19 Dec 2002 22:31:34 +0000 (22:31 -0000)
committerMiguel de Icaza <miguel@gnome.org>
Thu, 19 Dec 2002 22:31:34 +0000 (22:31 -0000)
* attribute.cs (Attributes.Contains): Add new method.

* class.cs (MethodCore.LabelParameters): if the parameter is an
`out' parameter, check that no attribute `[In]' has been passed.

svn path=/trunk/mcs/; revision=9785

mcs/mcs/attribute.cs
mcs/mcs/enum.cs
mcs/mcs/typemanager.cs

index e81e782db78b141da2703f770b9158a4727f122f..cb206c030e5f170392669075f2dc2e13938cabb6 100644 (file)
@@ -956,7 +956,6 @@ namespace Mono.CSharp {
        }\r
        \r
        public class AttributeSection {\r
-               \r
                public readonly string    Target;\r
                public readonly ArrayList Attributes;\r
                \r
@@ -983,5 +982,16 @@ namespace Mono.CSharp {
                        if (a != null && !AttributeSections.Contains (a))\r
                                AttributeSections.Add (a);\r
                }\r
+\r
+               public bool Contains (Type t)\r
+               {\r
+                       foreach (AttributeSection attr_section in AttributeSections){\r
+                               foreach (Attribute a in attr_section.Attributes){\r
+                                       if (a.Type == t)\r
+                                               return true;\r
+                               }\r
+                       }\r
+                       return false;\r
+               }\r
        }\r
 }\r
index 134e253130b9095a453444c8f11abcb3f540b353..96449379c28911a6c1d08d27b6bd1fd17251f2be 100755 (executable)
@@ -556,8 +556,12 @@ namespace Mono.CSharp {
 
                                        if (default_value == null)
                                                return true;
-
                                } else {
+                                       if (name == "value__"){
+                                               Report.Error (76, loc, "The name `value__' is reserved for enumerations");
+                                               return false;
+                                       }
+
                                        FieldBuilder fb = TypeBuilder.DefineField (
                                                name, UnderlyingType, attr);
                                        
index f6fda8ca320dbd3b11d7622987e266f067667623..f0794deabbf2b72fa566734bd344e604743f2c1d 100755 (executable)
@@ -80,6 +80,7 @@ public class TypeManager {
        static public Type exception_type;
        static public object obsolete_attribute_type;
        static public object conditional_attribute_type;
+       static public Type in_attribute_type;
 
        //
        // An empty array of types
@@ -922,8 +923,9 @@ public class TypeManager {
                attribute_usage_type = CoreLookupType ("System.AttributeUsageAttribute");
                dllimport_type       = CoreLookupType ("System.Runtime.InteropServices.DllImportAttribute");
                methodimpl_attr_type = CoreLookupType ("System.Runtime.CompilerServices.MethodImplAttribute");
-               marshal_as_attr_type  = CoreLookupType ("System.Runtime.InteropServices.MarshalAsAttribute");
-               param_array_type      = CoreLookupType ("System.ParamArrayAttribute");
+               marshal_as_attr_type = CoreLookupType ("System.Runtime.InteropServices.MarshalAsAttribute");
+               param_array_type     = CoreLookupType ("System.ParamArrayAttribute");
+               in_attribute_type    = CoreLookupType ("System.Runtime.InteropServices.InAttribute");
 
                //
                // Temporary while people upgrade their corlibs