public TargetType LookupMonoType(Cecil.TypeReference type)
{
TargetType result = (TargetType) type_hash [type];
if (result != null)
return result;
if (type is Cecil.ArrayType) {
Cecil.ArrayType atype = (Cecil.ArrayType) type;
TargetType element_type = LookupMonoType (atype.ElementType);
result = new MonoArrayType (element_type, atype.Rank);
} else if (type is Cecil.TypeDefinition) {
Cecil.TypeDefinition tdef = (Cecil.TypeDefinition) type;
if (tdef.IsEnum)
result = new MonoEnumType (this, tdef);
else
result = new MonoClassType (this, tdef);
} else {
Console.WriteLine ("UNKNOWN TYPE: {0} {1}", type, type.GetType ());
return null;
}
if (!type_hash.Contains (type))
type_hash.Add (type, result);
return result;
}