From: Miguel de Icaza Date: Thu, 19 Dec 2002 22:31:34 +0000 (-0000) Subject: 2002-12-19 Miguel de Icaza X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=commitdiff_plain;h=63c75e1f0e6a0d286c3c2ef0ebcf758bf44a369b;p=mono.git 2002-12-19 Miguel de Icaza * 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 --- diff --git a/mcs/mcs/attribute.cs b/mcs/mcs/attribute.cs index e81e782db78..cb206c030e5 100644 --- a/mcs/mcs/attribute.cs +++ b/mcs/mcs/attribute.cs @@ -956,7 +956,6 @@ namespace Mono.CSharp { } public class AttributeSection { - public readonly string Target; public readonly ArrayList Attributes; @@ -983,5 +982,16 @@ namespace Mono.CSharp { if (a != null && !AttributeSections.Contains (a)) AttributeSections.Add (a); } + + public bool Contains (Type t) + { + foreach (AttributeSection attr_section in AttributeSections){ + foreach (Attribute a in attr_section.Attributes){ + if (a.Type == t) + return true; + } + } + return false; + } } } diff --git a/mcs/mcs/enum.cs b/mcs/mcs/enum.cs index 134e253130b..96449379c28 100755 --- a/mcs/mcs/enum.cs +++ b/mcs/mcs/enum.cs @@ -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); diff --git a/mcs/mcs/typemanager.cs b/mcs/mcs/typemanager.cs index f6fda8ca320..f0794deabbf 100755 --- a/mcs/mcs/typemanager.cs +++ b/mcs/mcs/typemanager.cs @@ -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