void IAssemblyCompilerStage.Run(AssemblyCompiler compiler) { // Save the Compiler _compiler = compiler; // The compilation target Architecture _architecture = compiler.Architecture; // The type system _typeSystem = RuntimeBase.Instance.TypeLoader; // Enumerate all types and do an appropriate type layout ReadOnlyRuntimeTypeListView types = _typeSystem.GetTypesFromModule(compiler.Assembly); foreach (RuntimeType type in types) { switch (type.Attributes & TypeAttributes.LayoutMask) { case TypeAttributes.AutoLayout: goto case TypeAttributes.SequentialLayout; case TypeAttributes.SequentialLayout: CreateSequentialLayout(type); break; case TypeAttributes.ExplicitLayout: CreateExplicitLayout(type); break; } } }
RuntimeType ITypeSystem.GetType(string typeName) { RuntimeType result = null; string[] names = typeName.Split(','); typeName = names[0]; int lastDot = typeName.LastIndexOf('.'); string ns, name; if (-1 == lastDot) { ns = String.Empty; name = typeName; } else { ns = typeName.Substring(0, lastDot); name = typeName.Substring(lastDot + 1); } /* FIXME: Typename could be a fully formatted type name, make sure * we support this one day, so we could use the assembly information * to reduce the lookup times. */ result = FindType(ns, name, _types); if (2 <= names.Length && null == result) { try { IMetadataModule module = RuntimeBase.Instance.AssemblyLoader.Load(names[1].Trim() + ".dll"); ITypeSystem ts = (ITypeSystem)this; result = FindType(ns, name, ts.GetTypesFromModule(module)); } catch { } } return(result); }