Author: jbevain
Date: 2005-02-26 18:16:23 -0500 (Sat, 26 Feb 2005)
New Revision: 41248
Modified:
trunk/cecil/lib/Mono.Cecil.Implem/LazyReflectionReader.cs
trunk/cecil/lib/Mono.Cecil.Implem/ModuleDefinition.cs
trunk/cecil/lib/Mono.Cecil.Implem/ReflectionReader.cs
Log:
lazy load extern classes
Modified: trunk/cecil/lib/Mono.Cecil.Implem/LazyReflectionReader.cs
===================================================================
--- trunk/cecil/lib/Mono.Cecil.Implem/LazyReflectionReader.cs 2005-02-26
22:44:29 UTC (rev 41247)
+++ trunk/cecil/lib/Mono.Cecil.Implem/LazyReflectionReader.cs 2005-02-26
23:16:23 UTC (rev 41248)
@@ -63,12 +63,37 @@
}
ExportedTypeTable etTable = m_root.Streams.TablesHeap [typeof
(ExportedTypeTable)] as ExportedTypeTable;
+ ITypeReference [] buffer = new ITypeReference [etTable.Rows.Count];
+
for (int i = 0; i < etTable.Rows.Count; i++) {
ExportedTypeRow etRow = etTable [i];
+ if (etRow.Implementation.TokenType != TokenType.File)
+ continue;
- //TODO: WRITE HERE
+ string name = m_root.Streams.StringsHeap [etRow.TypeName];
+ string ns = m_root.Streams.StringsHeap [etRow.TypeNamespace];
+ if (ns.Length == 0)
+ buffer [i] = Module.TypeReferences [name];
+ else
+ buffer [i] = Module.TypeReferences [string.Concat (ns,
'.', name)];
}
+ for (int i = 0; i < etTable.Rows.Count; i++) {
+ ExportedTypeRow etRow = etTable [i];
+ if (etRow.Implementation.TokenType != TokenType.ExportedType)
+ continue;
+
+ ITypeReference owner = buffer [etRow.Implementation.RID - 1];
+ string name = m_root.Streams.StringsHeap [etRow.TypeName];
+ buffer [i] = Module.TypeReferences [string.Concat
(owner.FullName, '/', name)];
+ }
+
+ for (int i = 0; i < buffer.Length; i++) {
+ ITypeReference curs = buffer [i];
+ if (curs != null)
+ ext [curs.FullName] = curs;
+ }
+
ext.Loaded = true;
}
Modified: trunk/cecil/lib/Mono.Cecil.Implem/ModuleDefinition.cs
===================================================================
--- trunk/cecil/lib/Mono.Cecil.Implem/ModuleDefinition.cs 2005-02-26
22:44:29 UTC (rev 41247)
+++ trunk/cecil/lib/Mono.Cecil.Implem/ModuleDefinition.cs 2005-02-26
23:16:23 UTC (rev 41248)
@@ -74,7 +74,7 @@
public IExternTypeCollection ExternTypes {
get {
if (m_externs == null)
- m_externs = new ExternTypeCollection (this);
+ m_externs = new ExternTypeCollection (this, m_loader);
return m_externs;
}
}
Modified: trunk/cecil/lib/Mono.Cecil.Implem/ReflectionReader.cs
===================================================================
--- trunk/cecil/lib/Mono.Cecil.Implem/ReflectionReader.cs 2005-02-26
22:44:29 UTC (rev 41247)
+++ trunk/cecil/lib/Mono.Cecil.Implem/ReflectionReader.cs 2005-02-26
23:16:23 UTC (rev 41248)
@@ -226,6 +226,11 @@
tdc [type.FullName] = type;
}
+ for (int i = 0; i < m_typeRefs.Length; i++) {
+ TypeReference type = m_typeRefs [i];
+ (m_module.TypeReferences as TypeReferenceCollection)
[type.FullName] = type;
+ }
+
ReadTypeSpecs ();
// set base types
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches