X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=blobdiff_plain;f=mcs%2Fgmcs%2Frootcontext.cs;h=8239ea423f62ddf47cf6c36d71a962b28488cf28;hb=17e12ece4b15c2a1b677ef6a4c7b71bff08b3354;hp=8641dc22b0fce5c96a7d6bc5c6a56731ddee2aae;hpb=856cd84f600ce36b8120de13e21b4aed0818e304;p=mono.git diff --git a/mcs/gmcs/rootcontext.cs b/mcs/gmcs/rootcontext.cs index 8641dc22b0f..8239ea423f6 100755 --- a/mcs/gmcs/rootcontext.cs +++ b/mcs/gmcs/rootcontext.cs @@ -46,7 +46,6 @@ namespace Mono.CSharp { // override). // static ArrayList type_container_resolve_order; - static ArrayList interface_resolve_order; static ArrayList attribute_types; // @@ -83,7 +82,6 @@ namespace Mono.CSharp { static RootContext () { tree = new Tree (); - interface_resolve_order = new ArrayList (); type_container_resolve_order = new ArrayList (); } @@ -101,11 +99,6 @@ namespace Mono.CSharp { static public string MainClass; - public static void RegisterOrder (Interface iface) - { - interface_resolve_order.Add (iface); - } - public static void RegisterOrder (TypeContainer tc) { type_container_resolve_order.Add (tc); @@ -273,7 +266,7 @@ namespace Mono.CSharp { object o = root.GetDefinition (name); if (o == null){ Report.Error (518, "The predefined type `" + name + "' is not defined"); - Environment.Exit (0); + Environment.Exit (1); } if (!(o is Delegate)){ @@ -310,7 +303,13 @@ namespace Mono.CSharp { "System.Runtime.Serialization.ISerializable", "System.Reflection.IReflect", - "System.Reflection.ICustomAttributeProvider" + "System.Reflection.ICustomAttributeProvider", + + // + // Generic types + // + "System.Collections.Generic.IEnumerator`1", + "System.Collections.Generic.IEnumerable`1" }; foreach (string iname in interfaces_first_stage) @@ -340,6 +339,7 @@ namespace Mono.CSharp { "System.Char", "System.Boolean", "System.Decimal", "System.Void", "System.RuntimeFieldHandle", + "System.RuntimeArgumentHandle", "System.RuntimeTypeHandle", "System.IntPtr", "System.TypedReference", @@ -378,7 +378,10 @@ namespace Mono.CSharp { "System.Security.UnverifiableCodeAttribute", "System.Runtime.CompilerServices.IndexerNameAttribute", "System.Runtime.InteropServices.InAttribute", + "System.Runtime.InteropServices.StructLayoutAttribute", + "System.Runtime.InteropServices.FieldOffsetAttribute", "System.InvalidOperationException", + "System.NotSupportedException", "System.MarshalByRefObject" }; @@ -417,9 +420,6 @@ namespace Mono.CSharp { foreach (TypeContainer tc in attribute_types) tc.CloseType (); - foreach (Interface iface in interface_resolve_order) - iface.CloseType (); - // // We do this in two passes, first we close the structs, // then the classes, because it seems the code needs it this @@ -427,13 +427,13 @@ namespace Mono.CSharp { // make sure that we define the structs in order as well. // foreach (TypeContainer tc in type_container_resolve_order){ - if (tc is Struct && tc.Parent == tree.Types){ + if (tc.Kind == Kind.Struct && tc.Parent == tree.Types){ tc.CloseType (); } } foreach (TypeContainer tc in type_container_resolve_order){ - if (!(tc is Struct && tc.Parent == tree.Types)) + if (!(tc.Kind == Kind.Struct && tc.Parent == tree.Types)) tc.CloseType (); } @@ -451,10 +451,9 @@ namespace Mono.CSharp { } attribute_types = null; - interface_resolve_order = null; type_container_resolve_order = null; helper_classes = null; - tree = null; + //tree = null; TypeManager.CleanUp (); } @@ -485,13 +484,13 @@ namespace Mono.CSharp { } static TypeExpr NamespaceLookup (DeclSpace ds, string name, - int num_type_args, Location loc) + int num_type_args, bool silent, Location loc) { // // Try in the current namespace and all its implicit parents // for (NamespaceEntry ns = ds.NamespaceEntry; ns != null; ns = ns.ImplicitParent) { - IAlias result = ns.Lookup (ds, name, num_type_args, loc); + IAlias result = ns.Lookup (ds, name, num_type_args, silent, loc); if (result == null) continue; @@ -554,7 +553,7 @@ namespace Mono.CSharp { containing_ds = containing_ds.Parent; } - t = NamespaceLookup (ds, name, num_type_params, loc); + t = NamespaceLookup (ds, name, num_type_params, silent, loc); if (t != null){ ds.Cache [name] = t; return t; @@ -576,20 +575,6 @@ namespace Mono.CSharp { return LookupType (tc, name, true, loc); } - static public bool IsNamespace (string name) - { - Namespace ns; - - if (tree.Namespaces != null){ - ns = (Namespace) tree.Namespaces [name]; - - if (ns != null) - return true; - } - - return false; - } - static void Report1530 (Location loc) { Report.Error (1530, loc, "Keyword new not allowed for namespace elements"); @@ -600,7 +585,7 @@ namespace Mono.CSharp { DeclSpace ds = (DeclSpace) root.GetDefinition (name); ds.DefineMembers (root); - ds.Define (root); + ds.Define (); } static public void BootCorlib_PopulateCoreTypes () @@ -625,15 +610,6 @@ namespace Mono.CSharp { if (attribute_types != null) foreach (TypeContainer tc in attribute_types) tc.DefineMembers (root); - - if (interface_resolve_order != null){ - foreach (Interface iface in interface_resolve_order) - if ((iface.ModFlags & Modifiers.NEW) == 0) - iface.DefineMembers (root); - else - Report1530 (iface.Location); - } - if (type_container_resolve_order != null){ if (RootContext.StdLib){ @@ -700,14 +676,7 @@ namespace Mono.CSharp { if (attribute_types != null) foreach (TypeContainer tc in attribute_types) - tc.Define (root); - - if (interface_resolve_order != null){ - foreach (Interface iface in interface_resolve_order) - if ((iface.ModFlags & Modifiers.NEW) == 0) - iface.Define (root); - } - + tc.Define (); if (type_container_resolve_order != null){ foreach (TypeContainer tc in type_container_resolve_order) { @@ -720,7 +689,7 @@ namespace Mono.CSharp { continue; if ((tc.ModFlags & Modifiers.NEW) == 0) - tc.Define (root); + tc.Define (); } } @@ -728,14 +697,14 @@ namespace Mono.CSharp { if (delegates != null){ foreach (Delegate d in delegates) if ((d.ModFlags & Modifiers.NEW) == 0) - d.Define (root); + d.Define (); } ArrayList enums = root.Enums; if (enums != null){ foreach (Enum en in enums) if ((en.ModFlags & Modifiers.NEW) == 0) - en.Define (root); + en.Define (); } } @@ -743,32 +712,27 @@ namespace Mono.CSharp { { if (attribute_types != null) foreach (TypeContainer tc in attribute_types) - tc.Emit (); + tc.EmitType (); - CodeGen.Assembly.Emit (); - CodeGen.Module.Emit (); + CodeGen.Assembly.Emit (Tree.Types); + CodeGen.Module.Emit (Tree.Types); if (Tree.Types.Enums != null) { foreach (Enum e in Tree.Types.Enums) - e.Emit (Tree.Types); + e.Emit (); } - if (interface_resolve_order != null){ - foreach (Interface iface in interface_resolve_order) - iface.Emit (Tree.Types); - } - if (type_container_resolve_order != null) { foreach (TypeContainer tc in type_container_resolve_order) tc.EmitConstants (); foreach (TypeContainer tc in type_container_resolve_order) - tc.Emit (); + tc.EmitType (); } if (Tree.Types.Delegates != null) { foreach (Delegate d in Tree.Types.Delegates) - d.Emit (Tree.Types); + d.Emit (); } // // Run any hooks after all the types have been defined.