- //
- // Resolves a struct during the corlib bootstrap process
- //
- static void BootstrapCorlib_ResolveInterface (TypeContainer root, string name)
- {
- object o = root.GetDefinition (name);
- if (o == null){
- Report.Error (518, "The predefined type `" + name + "' is not defined or imported");
- return;
- }
-
- if (!(o is Interface)){
- if (o is DeclSpace){
- DeclSpace d = (DeclSpace) o;
-
- Error_TypeConflict (name, d.Location);
- } else
- Error_TypeConflict (name);
-
- return;
- }
-
- ((DeclSpace) o).DefineType ();
- }
-
- //
- // Resolves a delegate during the corlib bootstrap process
- //
- static void BootstrapCorlib_ResolveDelegate (TypeContainer root, string name)
- {
- object o = root.GetDefinition (name);
- if (o == null){
- Report.Error (518, "The predefined type `" + name + "' is not defined or imported");
- return;
- }
-
- if (!(o is Delegate)){
- Error_TypeConflict (name);
- return;
- }
-
- ((DeclSpace) o).DefineType ();
- }
-
-
- /// <summary>
- /// Resolves the core types in the compiler when compiling with --nostdlib
- /// </summary>
- static public void ResolveCore ()
- {
- TypeContainer root = Tree.Types;
-
- TypeManager.object_type = BootstrapCorlib_ResolveClass (root, "System.Object");
- TypeManager.value_type = BootstrapCorlib_ResolveClass (root, "System.ValueType");
- TypeManager.attribute_type = BootstrapCorlib_ResolveClass (root, "System.Attribute");
- TypeManager.indexer_name_type = BootstrapCorlib_ResolveClass (root, "System.Runtime.CompilerServices.IndexerNameAttribute");
-
- string [] interfaces_first_stage = {
- "System.IComparable", "System.ICloneable",
- "System.IConvertible",
-
- "System.Collections.IEnumerable",
- "System.Collections.ICollection",
- "System.Collections.IEnumerator",
- "System.Collections.IList",
- "System.IAsyncResult",
- "System.IDisposable",
-
- "System.Runtime.Serialization.ISerializable",
-
- "System.Reflection.IReflect",
- "System.Reflection.ICustomAttributeProvider"
- };
-
- foreach (string iname in interfaces_first_stage)
- BootstrapCorlib_ResolveInterface (root, iname);
-
- //
- // These are the base value types
- //
- string [] structs_first_stage = {
- "System.Byte", "System.SByte",
- "System.Int16", "System.UInt16",
- "System.Int32", "System.UInt32",
- "System.Int64", "System.UInt64",
- };
-
- foreach (string cname in structs_first_stage)
- BootstrapCorlib_ResolveStruct (root, cname);
-
- //
- // Now, we can load the enumerations, after this point,
- // we can use enums.
- //
- TypeManager.InitEnumUnderlyingTypes ();
-
- string [] structs_second_stage = {
- "System.Single", "System.Double",
- "System.Char", "System.Boolean",
- "System.Decimal", "System.Void",
- "System.RuntimeFieldHandle",
- "System.RuntimeArgumentHandle",
- "System.RuntimeTypeHandle",
- "System.IntPtr",
- "System.TypedReference",
- "System.ArgIterator"
- };
-
- foreach (string cname in structs_second_stage)
- BootstrapCorlib_ResolveStruct (root, cname);
-
- //
- // These are classes that depends on the core interfaces
- //
- string [] classes_second_stage = {
- "System.Enum",
- "System.String",
- "System.Array",
- "System.Reflection.MemberInfo",
- "System.Type",
- "System.Exception",
-
- //
- // These are not really important in the order, but they
- // are used by the compiler later on (typemanager/CoreLookupType-d)
- //
- "System.Runtime.CompilerServices.RuntimeHelpers",
- "System.Reflection.DefaultMemberAttribute",
- "System.Threading.Monitor",
-
- "System.AttributeUsageAttribute",
- "System.Runtime.InteropServices.DllImportAttribute",
- "System.Runtime.CompilerServices.MethodImplAttribute",
- "System.Runtime.InteropServices.MarshalAsAttribute",
- "System.Diagnostics.ConditionalAttribute",
- "System.ObsoleteAttribute",
- "System.ParamArrayAttribute",
- "System.CLSCompliantAttribute",
- "System.Security.UnverifiableCodeAttribute",
- "System.Security.Permissions.SecurityAttribute",
- "System.Runtime.CompilerServices.DecimalConstantAttribute",
- "System.Runtime.InteropServices.InAttribute",
- "System.Runtime.InteropServices.OutAttribute",
- "System.Runtime.InteropServices.StructLayoutAttribute",
- "System.Runtime.InteropServices.FieldOffsetAttribute",
- "System.InvalidOperationException",
- "System.NotSupportedException",
- "System.MarshalByRefObject",
- "System.Security.CodeAccessPermission",
- "System.Runtime.CompilerServices.RequiredAttributeAttribute",
- "System.Runtime.InteropServices.GuidAttribute",
- "System.Reflection.AssemblyCultureAttribute"
- };
-
- foreach (string cname in classes_second_stage)
- BootstrapCorlib_ResolveClass (root, cname);
-
- BootstrapCorlib_ResolveDelegate (root, "System.AsyncCallback");
-
- // These will be defined indirectly during the previous ResolveDelegate.
- // However make sure the rest of the checks happen.
- string [] delegate_types = { "System.Delegate", "System.MulticastDelegate" };
- foreach (string cname in delegate_types)
- BootstrapCorlib_ResolveClass (root, cname);
- }
-