Use generic prop creator if the type has a generic parameter
This commit is contained in:
parent
f05a334c11
commit
1d2a78979f
|
@ -89,7 +89,7 @@ namespace de4dot.code.renamer {
|
||||||
public string getNewPropertyName(PropertyDefinition propertyDefinition) {
|
public string getNewPropertyName(PropertyDefinition propertyDefinition) {
|
||||||
var propType = propertyDefinition.PropertyType;
|
var propType = propertyDefinition.PropertyType;
|
||||||
string newName;
|
string newName;
|
||||||
if (propType is GenericParameter)
|
if (isGeneric(propType))
|
||||||
newName = existingPropertyNames.getName(propertyDefinition.Name, genericPropertyNameCreator);
|
newName = existingPropertyNames.getName(propertyDefinition.Name, genericPropertyNameCreator);
|
||||||
else
|
else
|
||||||
newName = existingPropertyNames.getName(propertyDefinition.Name, () => propertyNameCreator.create(propType));
|
newName = existingPropertyNames.getName(propertyDefinition.Name, () => propertyNameCreator.create(propType));
|
||||||
|
@ -97,6 +97,17 @@ namespace de4dot.code.renamer {
|
||||||
return newName;
|
return newName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool isGeneric(TypeReference type) {
|
||||||
|
while (true) {
|
||||||
|
if (type is GenericParameter)
|
||||||
|
return true;
|
||||||
|
var ts = type as TypeSpecification;
|
||||||
|
if (ts == null)
|
||||||
|
return false;
|
||||||
|
type = ts.ElementType;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public string getNewEventName(EventDefinition eventDefinition) {
|
public string getNewEventName(EventDefinition eventDefinition) {
|
||||||
string newName = eventNameCreator.create();
|
string newName = eventNameCreator.create();
|
||||||
addEventName(newName);
|
addEventName(newName);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user