static InstructionPushPopInfo?GetInstructionPops(InstructionVM instr) { var code = instr.Code; if (code == Code.Pop || code == Code.Nop) { return(null); } int pushes, pops; instr.CalculateStackUsage(out pushes, out pops); if (pops < 0) { return(null); } if (pushes == 1 && (code == Code.Call || code == Code.Callvirt || code == Code.Calli)) { return(new InstructionPushPopInfo(pops, GetMethodSig(instr.InstructionOperandVM.Other).GetRetType())); } if (pushes == 1 && code == Code.Newobj) { var ctor = instr.InstructionOperandVM.Other as IMethod; return(new InstructionPushPopInfo(pops, ctor == null ? null : ctor.DeclaringType.ToTypeSig())); } if (pushes != 0) { return(null); } return(new InstructionPushPopInfo(pops)); }
static InstructionPushPopInfo? GetInstructionPops(InstructionVM instr) { var code = instr.Code; if (code == Code.Pop || code == Code.Nop) return null; int pushes, pops; instr.CalculateStackUsage(out pushes, out pops); if (pops < 0) return null; if (pushes == 1 && (code == Code.Call || code == Code.Callvirt || code == Code.Calli)) return new InstructionPushPopInfo(pops, GetMethodSig(instr.InstructionOperandVM.Other).GetRetType()); if (pushes == 1 && code == Code.Newobj) { var ctor = instr.InstructionOperandVM.Other as IMethod; return new InstructionPushPopInfo(pops, ctor == null ? null : ctor.DeclaringType.ToTypeSig()); } if (pushes != 0) return null; return new InstructionPushPopInfo(pops); }