Make canInline() virtual and move some logic there
This commit is contained in:
parent
f3525d8980
commit
01a893a799
|
@ -40,7 +40,12 @@ namespace de4dot.blocks.cflow {
|
|||
return changed;
|
||||
}
|
||||
|
||||
bool canInline(MethodDefinition method) {
|
||||
protected virtual bool canInline(MethodDefinition method) {
|
||||
if (MemberReferenceHelper.compareMethodReferenceAndDeclaringType(method, blocks.Method))
|
||||
return false;
|
||||
if (!MemberReferenceHelper.compareTypes(method.DeclaringType, blocks.Method.DeclaringType))
|
||||
return false;
|
||||
|
||||
if (method.IsStatic)
|
||||
return true;
|
||||
if (method.IsVirtual)
|
||||
|
@ -52,16 +57,12 @@ namespace de4dot.blocks.cflow {
|
|||
var methodToInline = callInstr.Operand as MethodDefinition;
|
||||
if (methodToInline == null)
|
||||
return false;
|
||||
if (MemberReferenceHelper.compareMethodReferenceAndDeclaringType(methodToInline, blocks.Method))
|
||||
return false;
|
||||
|
||||
if (!canInline(methodToInline))
|
||||
return false;
|
||||
var body = methodToInline.Body;
|
||||
if (body == null)
|
||||
return false;
|
||||
if (!MemberReferenceHelper.compareTypes(methodToInline.DeclaringType, blocks.Method.DeclaringType))
|
||||
return false;
|
||||
|
||||
int index = 0;
|
||||
var instr = DotNetUtils.getInstruction(body.Instructions, ref index);
|
||||
|
|
Loading…
Reference in New Issue
Block a user