Permalink
Browse files

delay the creation of the type system

  • Loading branch information...
1 parent ab810e3 commit f483acec646d705adf07051bd6bbfb6b90c851d5 @jbevain jbevain committed Jun 14, 2010
Showing with 13 additions and 3 deletions.
  1. +12 −2 Mono.Cecil/ModuleDefinition.cs
  2. +1 −1 dbg/Program.cs
@@ -123,13 +123,14 @@ public sealed class WriterParameters {
public sealed class ModuleDefinition : ModuleReference, ICustomAttributeProvider {
internal Image Image;
- internal TypeSystem TypeSystem;
internal MetadataSystem MetadataSystem;
internal ReadingMode ReadingMode;
internal IAssemblyResolver AssemblyResolver;
internal ISymbolReaderProvider SymbolReaderProvider;
internal ISymbolReader SymbolReader;
+ TypeSystem type_system;
+
readonly MetadataReader reader;
readonly string fq_name;
@@ -210,6 +211,16 @@ public sealed class ModuleDefinition : ModuleReference, ICustomAttributeProvider
}
}
#endif
+
+ internal TypeSystem TypeSystem {
+ get {
+ if (type_system == null)
+ type_system = TypeSystem.CreateTypeSystem (this);
+
+ return type_system;
+ }
+ }
+
public bool HasAssemblyReferences {
get {
if (references != null)
@@ -363,7 +374,6 @@ public sealed class ModuleDefinition : ModuleReference, ICustomAttributeProvider
internal ModuleDefinition ()
{
- this.TypeSystem = TypeSystem.CreateTypeSystem (this);
this.MetadataSystem = new MetadataSystem ();
this.token = new MetadataToken (TokenType.Module, 1);
this.AssemblyResolver = GlobalAssemblyResolver.Instance;
View
@@ -54,7 +54,7 @@ static ModuleDefinition GetModule (string module)
static ModuleDefinition GetCurrentModule ()
{
- return GetModule (typeof (ModuleDefinition).Module.FullyQualifiedName);
+ return GetModule (typeof (object).Module.FullyQualifiedName);
}
}
}

0 comments on commit f483ace

Please sign in to comment.