// override).
//
static ArrayList type_container_resolve_order;
- static ArrayList interface_resolve_order;
static ArrayList attribute_types;
//
static RootContext ()
{
tree = new Tree ();
- interface_resolve_order = new ArrayList ();
type_container_resolve_order = new ArrayList ();
}
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);
"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)
"System.Char", "System.Boolean",
"System.Decimal", "System.Void",
"System.RuntimeFieldHandle",
+ "System.RuntimeArgumentHandle",
"System.RuntimeTypeHandle",
"System.IntPtr",
"System.TypedReference",
"System.Runtime.InteropServices.StructLayoutAttribute",
"System.Runtime.InteropServices.FieldOffsetAttribute",
"System.InvalidOperationException",
+ "System.NotSupportedException",
"System.MarshalByRefObject"
};
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
// 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 ();
}
}
attribute_types = null;
- interface_resolve_order = null;
type_container_resolve_order = null;
helper_classes = null;
- tree = null;
+ //tree = null;
TypeManager.CleanUp ();
}
if (ds.Cache.Contains (name)){
t = (TypeExpr) ds.Cache [name];
+ if (t != null)
+ return t;
} else {
//
// For the case the type we are looking for is nested within this one
while (containing_ds != null){
Type current_type = containing_ds.TypeBuilder;
- while (current_type != null &&
- current_type != TypeManager.object_type) {
+ while (current_type != null) {
//
// nested class
//
}
t = NamespaceLookup (ds, name, num_type_params, silent, loc);
- if (!silent)
+ if (t != null){
ds.Cache [name] = t;
+ return t;
+ }
}
- if (t == null && !silent)
+ if (!silent)
Report.Error (246, loc, "Cannot find type `"+name+"'");
- return t;
+ return null;
}
// <summary>
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");
DeclSpace ds = (DeclSpace) root.GetDefinition (name);
ds.DefineMembers (root);
- ds.Define (root);
+ ds.Define ();
}
static public void BootCorlib_PopulateCoreTypes ()
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){
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) {
continue;
if ((tc.ModFlags & Modifiers.NEW) == 0)
- tc.Define (root);
+ tc.Define ();
}
}
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 ();
}
}
{
if (attribute_types != null)
foreach (TypeContainer tc in attribute_types)
- tc.Emit ();
+ tc.EmitType ();
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.