Update renamer code. Check for unresolved type and generic params

This commit is contained in:
de4dot 2011-12-04 18:22:47 +01:00
parent 4efd4e17d5
commit 99cec56165

View File

@ -1032,6 +1032,8 @@ namespace de4dot.renamer {
if (extType == null) if (extType == null)
return null; return null;
var extTypeDef = modules.resolveOther(extType); var extTypeDef = modules.resolveOther(extType);
if (extTypeDef == null)
return null;
var theMethodDef = extTypeDef.find(theMethod); var theMethodDef = extTypeDef.find(theMethod);
if (theMethodDef != null) if (theMethodDef != null)
return theMethodDef.Event; return theMethodDef.Event;
@ -1146,6 +1148,8 @@ namespace de4dot.renamer {
if (extType == null) if (extType == null)
return null; return null;
var extTypeDef = modules.resolveOther(extType); var extTypeDef = modules.resolveOther(extType);
if (extTypeDef == null)
return null;
var theMethodDef = extTypeDef.find(theMethod); var theMethodDef = extTypeDef.find(theMethod);
if (theMethodDef != null) if (theMethodDef != null)
return theMethodDef.Property; return theMethodDef.Property;
@ -1176,12 +1180,16 @@ namespace de4dot.renamer {
const string defaultVal = "Prop_"; const string defaultVal = "Prop_";
var propType = getPropertyType(scope); var propType = getPropertyType(scope);
if (propType == null || propType is GenericInstanceType || propType is GenericParameter) if (propType == null)
return defaultVal;
var elementType = propType.GetElementType();
if (propType is GenericInstanceType || elementType is GenericParameter)
return defaultVal; return defaultVal;
var prefix = getPrefix(propType); var prefix = getPrefix(propType);
string name = propType.GetElementType().Name; string name = elementType.Name;
int i; int i;
if ((i = name.IndexOf('`')) >= 0) if ((i = name.IndexOf('`')) >= 0)
name = name.Substring(0, i); name = name.Substring(0, i);