X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=blobdiff_plain;f=mcs%2Fmcs%2Frootcontext.cs;h=b429b974de11d5c2ee4ab09df266c47ff387ce9b;hb=5f0dc4802f69745ced8f32b39bd770f7bd134b8f;hp=b0dd5583ad9a3967dd8de1b7d35a32c37508f3b2;hpb=40ea2dfb2d871b47e8d74bdbd2963ab7fa059f11;p=mono.git diff --git a/mcs/mcs/rootcontext.cs b/mcs/mcs/rootcontext.cs index b0dd5583ad9..b429b974de1 100755 --- a/mcs/mcs/rootcontext.cs +++ b/mcs/mcs/rootcontext.cs @@ -353,6 +353,7 @@ namespace Mono.CSharp { "System.ParamArrayAttribute", "System.Security.UnverifiableCodeAttribute", "System.Runtime.CompilerServices.IndexerNameAttribute", + "System.Runtime.InteropServices.InAttribute" }; // We must store them here before calling BootstrapCorlib_ResolveDelegate. @@ -414,7 +415,7 @@ namespace Mono.CSharp { if (root.Delegates != null) foreach (Delegate d in root.Delegates) - d.CloseDelegate (); + d.CloseType (); // @@ -440,7 +441,7 @@ namespace Mono.CSharp { return ns.Substring (0, i); } - static Type NamespaceLookup (Namespace curr_ns, string name) + static Type NamespaceLookup (Namespace curr_ns, string name, Location loc) { Type t; @@ -492,13 +493,21 @@ namespace Mono.CSharp { if (using_list == null) continue; + Type match = null; foreach (Namespace.UsingEntry ue in using_list) { - t = TypeManager.LookupType (MakeFQN (ue.Name, name)); - if (t != null){ + match = TypeManager.LookupType (MakeFQN (ue.Name, name)); + if (match != null){ + if (t != null){ + DeclSpace.Error_AmbiguousTypeReference (loc, name, t, match); + return null; + } + + t = match; ue.Used = true; - return t; } } + if (t != null) + return t; // // Try with aliases @@ -547,7 +556,7 @@ namespace Mono.CSharp { // // nested class // - t = TypeManager.LookupType (current_type.FullName + "+" + name); + t = TypeManager.LookupType (current_type.FullName + "." + name); if (t != null){ ds.Cache [name] = t; return t; @@ -559,7 +568,7 @@ namespace Mono.CSharp { containing_ds = containing_ds.Parent; } - t = NamespaceLookup (ds.Namespace, name); + t = NamespaceLookup (ds.Namespace, name, loc); if (t != null){ ds.Cache [name] = t; return t; @@ -641,20 +650,28 @@ namespace Mono.CSharp { if (type_container_resolve_order != null){ - foreach (TypeContainer tc in type_container_resolve_order) { - // When compiling corlib, these types have already been - // populated from BootCorlib_PopulateCoreTypes (). - if (!RootContext.StdLib && - ((tc.Name == "System.Object") || - (tc.Name == "System.Attribute") || - (tc.Name == "System.ValueType"))) + if (RootContext.StdLib){ + foreach (TypeContainer tc in type_container_resolve_order) { + if ((tc.ModFlags & Modifiers.NEW) == 0) + tc.DefineMembers (root); + else + Report1530 (tc.Location); + } + } else { + foreach (TypeContainer tc in type_container_resolve_order) { + // When compiling corlib, these types have already been + // populated from BootCorlib_PopulateCoreTypes (). + if (((tc.Name == "System.Object") || + (tc.Name == "System.Attribute") || + (tc.Name == "System.ValueType"))) continue; - if ((tc.ModFlags & Modifiers.NEW) == 0) - tc.DefineMembers (root); - else - Report1530 (tc.Location); - } + if ((tc.ModFlags & Modifiers.NEW) == 0) + tc.DefineMembers (root); + else + Report1530 (tc.Location); + } + } } ArrayList delegates = root.Delegates; @@ -738,7 +755,7 @@ namespace Mono.CSharp { Attributes attrs = (Attributes) de.Value; dummy.Namespace = ns; - Attribute.ApplyAttributes (temp_ec, ab, ab, attrs, attrs.Location); + Attribute.ApplyAttributes (temp_ec, ab, ab, attrs); } } @@ -760,7 +777,8 @@ namespace Mono.CSharp { return; } - CustomAttributeBuilder cb = new CustomAttributeBuilder (TypeManager.unverifiable_code_ctor, new object [0]); + CustomAttributeBuilder cb = new CustomAttributeBuilder (TypeManager.unverifiable_code_ctor, + new object [0]); CodeGen.ModuleBuilder.SetCustomAttribute (cb); } } @@ -815,16 +833,15 @@ namespace Mono.CSharp { // Adds a global attribute that was declared in `container', // the attribute is in `attr', and it was defined at `loc' // - static public void AddGlobalAttribute (TypeContainer container, - AttributeSection attr, Location loc) + static public void AddGlobalAttributeSection (TypeContainer container, AttributeSection attr) { Namespace ns = container.Namespace; Attributes a = (Attributes) global_attributes [ns]; if (a == null) - global_attributes [ns] = new Attributes (attr, loc); + global_attributes [ns] = new Attributes (attr); else - a.AddAttribute (attr); + a.AddAttributeSection (attr); } } }