Only protect *Invoke methods. Rename and remove a variable
This commit is contained in:
parent
555ca393e2
commit
98cdcf9ca5
|
@ -926,26 +926,20 @@ namespace de4dot.renamer {
|
||||||
return;
|
return;
|
||||||
methodDef.Renamed = true;
|
methodDef.Renamed = true;
|
||||||
|
|
||||||
bool canRenameName = true;
|
bool canRenameMethodName = true;
|
||||||
if (IsDelegate && methodDef.isVirtual()) {
|
if (IsDelegate && methodDef.isVirtual()) {
|
||||||
switch (methodDef.MethodDefinition.Name) {
|
switch (methodDef.MethodDefinition.Name) {
|
||||||
case "GetMethodImpl":
|
|
||||||
case "CombineImpl":
|
|
||||||
case "DynamicInvokeImpl":
|
|
||||||
case "GetInvocationList":
|
|
||||||
case "RemoveImpl":
|
|
||||||
case "Invoke":
|
|
||||||
case "BeginInvoke":
|
case "BeginInvoke":
|
||||||
case "EndInvoke":
|
case "EndInvoke":
|
||||||
canRenameName = false;
|
case "Invoke":
|
||||||
|
canRenameMethodName = false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var variableNameState = MemberRenameState.variableNameState;
|
var variableNameState = MemberRenameState.variableNameState;
|
||||||
bool isVirtual = methodDef.isVirtual();
|
|
||||||
|
|
||||||
if (canRenameName) {
|
if (canRenameMethodName) {
|
||||||
var nameCreator = getMethodNameCreator(methodDef, suggestedName);
|
var nameCreator = getMethodNameCreator(methodDef, suggestedName);
|
||||||
if (!methodDef.MethodDefinition.IsRuntimeSpecialName && !variableNameState.IsValidName(methodDef.OldName))
|
if (!methodDef.MethodDefinition.IsRuntimeSpecialName && !variableNameState.IsValidName(methodDef.OldName))
|
||||||
methodDef.NewName = nameCreator.newName();
|
methodDef.NewName = nameCreator.newName();
|
||||||
|
@ -963,7 +957,7 @@ namespace de4dot.renamer {
|
||||||
|
|
||||||
prepareRenameGenericParams(methodDef.GenericParams, variableNameState.IsValidName, methodDef.Owner == null ? null : methodDef.Owner.genericParams);
|
prepareRenameGenericParams(methodDef.GenericParams, variableNameState.IsValidName, methodDef.Owner == null ? null : methodDef.Owner.genericParams);
|
||||||
|
|
||||||
if (isVirtual)
|
if (methodDef.isVirtual())
|
||||||
MemberRenameState.add(methodDef);
|
MemberRenameState.add(methodDef);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user