Use available method, and get rid of useless code

This commit is contained in:
de4dot 2011-10-24 19:45:31 +02:00
parent cb5589ee28
commit e92c2ce97b

View File

@ -123,7 +123,7 @@ namespace de4dot.blocks.cflow {
bool inlineOtherMethod(int patchIndex, MethodDefinition method, Instruction instr, int instrIndex) { bool inlineOtherMethod(int patchIndex, MethodDefinition method, Instruction instr, int instrIndex) {
int loadIndex = 0; int loadIndex = 0;
int methodArgsCount = (method.HasThis ? 1 : 0) + method.Parameters.Count; int methodArgsCount = DotNetUtils.getArgsCount(method);
while (instr != null && loadIndex < methodArgsCount) { while (instr != null && loadIndex < methodArgsCount) {
switch (instr.OpCode.Code) { switch (instr.OpCode.Code) {
case Code.Ldarg: case Code.Ldarg:
@ -190,8 +190,6 @@ namespace de4dot.blocks.cflow {
if (instr == null) if (instr == null)
return null; return null;
index = instructions.IndexOf(instr); index = instructions.IndexOf(instr);
if (index < 0)
return null;
} }
return null; return null;
} }