Esempio n. 1
0
 public bool IsLdloc(CodeInstruction instruction, out LocalVar local)
 {
     if (instruction.opcode == OpCodes.Ldloc || instruction.opcode == OpCodes.Ldloc_S)
     {
         local = new LocalVar((LocalVariableInfo)instruction.operand); // note: LocalBuilder derives from LocalVariableInfo
     }
     else if (instruction.opcode == OpCodes.Ldloc_0)
     {
         local = new LocalVar(locals[0]);
     }
     else if (instruction.opcode == OpCodes.Ldloc_1)
     {
         local = new LocalVar(locals[1]);
     }
     else if (instruction.opcode == OpCodes.Ldloc_2)
     {
         local = new LocalVar(locals[2]);
     }
     else if (instruction.opcode == OpCodes.Ldloc_3)
     {
         local = new LocalVar(locals[3]);
     }
     else
     {
         local = default;
         return(false);
     }
     return(true);
 }
Esempio n. 2
0
 public bool IsLdloca(CodeInstruction instruction, out LocalVar local)
 {
     if (instruction.opcode == OpCodes.Ldloca || instruction.opcode == OpCodes.Ldloca_S)
     {
         local = new LocalVar((LocalVariableInfo)instruction.operand); // note: LocalBuilder derives from LocalVariableInfo
         return(true);
     }
     else
     {
         local = default;
         return(false);
     }
 }
Esempio n. 3
0
 public bool IsStloc(CodeInstruction instruction, LocalVar local)
 {
     return(IsStloc(instruction, out var otherLocal) && local == otherLocal);
 }