Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/cecil.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjbevain <jbevain@gmail.com>2010-09-17 18:18:58 +0400
committerjbevain <jbevain@gmail.com>2010-09-17 18:18:58 +0400
commit4d9da9e9a007e6c45c63044ac546b2e3c0c09832 (patch)
tree914986a0bbfc10e1fdcf96665960c260bd0f589b
parent96e52c6f3c576d441a0382b5892321ba8597c471 (diff)
Expose the TypeSystem to ease usage of primitive types
-rw-r--r--Mono.Cecil/ModuleDefinition.cs2
-rw-r--r--Mono.Cecil/TypeSystem.cs12
2 files changed, 11 insertions, 3 deletions
diff --git a/Mono.Cecil/ModuleDefinition.cs b/Mono.Cecil/ModuleDefinition.cs
index 8576b17..597a4b6 100644
--- a/Mono.Cecil/ModuleDefinition.cs
+++ b/Mono.Cecil/ModuleDefinition.cs
@@ -264,7 +264,7 @@ namespace Mono.Cecil {
}
#endif
- internal TypeSystem TypeSystem {
+ public TypeSystem TypeSystem {
get { return type_system ?? (type_system = TypeSystem.CreateTypeSystem (this)); }
}
diff --git a/Mono.Cecil/TypeSystem.cs b/Mono.Cecil/TypeSystem.cs
index f7eedc5..59f72a8 100644
--- a/Mono.Cecil/TypeSystem.cs
+++ b/Mono.Cecil/TypeSystem.cs
@@ -32,7 +32,7 @@ using Mono.Cecil.Metadata;
namespace Mono.Cecil {
- abstract class TypeSystem {
+ public abstract class TypeSystem {
sealed class CorlibTypeSystem : TypeSystem {
@@ -43,7 +43,11 @@ namespace Mono.Cecil {
internal override TypeReference LookupType (string @namespace, string name)
{
- var types = module.MetadataSystem.Types;
+ var metadata = module.MetadataSystem;
+ if (metadata.Types == null)
+ Initialize (module.Types);
+
+ var types = metadata.Types;
for (int i = 0; i < types.Length; i++) {
var type = types [i];
@@ -56,6 +60,10 @@ namespace Mono.Cecil {
return null;
}
+
+ static void Initialize (object obj)
+ {
+ }
}
sealed class CommonTypeSystem : TypeSystem {