Fix resolver

This commit is contained in:
de4dot 2012-04-24 11:25:39 +02:00
parent 93e372557f
commit 88d7607d10

View File

@ -48,10 +48,19 @@ namespace de4dot.code {
dataDict.Remove(name);
}
static TypeReference getNonGenericTypeReference(TypeReference typeReference) {
if (typeReference == null)
return null;
if (!typeReference.IsGenericInstance)
return typeReference;
var type = (GenericInstanceType)typeReference;
return type.ElementType;
}
public TypeDefinition resolve(TypeReference type) {
if (type == null)
return null;
var typeDef = type as TypeDefinition;
var typeDef = getNonGenericTypeReference(type) as TypeDefinition;
if (typeDef != null)
return typeDef;