X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=blobdiff_plain;f=mcs%2Fmcs%2Frootcontext.cs;h=b429b974de11d5c2ee4ab09df266c47ff387ce9b;hb=5f0dc4802f69745ced8f32b39bd770f7bd134b8f;hp=09b74280f2e5ce671ebbff59786a76d0482439ef;hpb=b0073413248a050d6f06bb1d9bdcc432cb37625b;p=mono.git diff --git a/mcs/mcs/rootcontext.cs b/mcs/mcs/rootcontext.cs index 09b74280f2e..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. @@ -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; @@ -497,7 +498,7 @@ namespace Mono.CSharp { match = TypeManager.LookupType (MakeFQN (ue.Name, name)); if (match != null){ if (t != null){ - Report.Error (104, "`" + name + "' is an ambiguous reference"); + DeclSpace.Error_AmbiguousTypeReference (loc, name, t, match); return null; } @@ -567,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; @@ -649,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; @@ -746,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); } } @@ -768,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); } } @@ -823,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); } } }