public static Instruction LdcI4(int value) { var ldcI4 = OpCodeHelper.LdcI4(value); return(ldcI4.Code switch { Code.Ldc_I4_S => Instruction.Create(ldcI4, (sbyte)value), Code.Ldc_I4 => Instruction.Create(ldcI4, value), _ => Instruction.Create(ldcI4) });
public static Instruction LdcI4(int value) { var ldcI4 = OpCodeHelper.LdcI4(value); switch (ldcI4.Code) { case Code.Ldc_I4_S: return(Instruction.Create(ldcI4, (sbyte)value)); case Code.Ldc_I4: return(Instruction.Create(ldcI4, value)); default: return(Instruction.Create(ldcI4)); } }
public static Instruction LdArg(int argIndex) { var ldArg = OpCodeHelper.LdArg(argIndex); return(ldArg.Equals(OpCodes.Ldarg_S) ? Instruction.Create(ldArg, argIndex) : Instruction.Create(ldArg)); }
public static Instruction LdElem(TypeReference typeReference) => Instruction.Create(OpCodeHelper.LdElem(typeReference));
public static Instruction StLoc(VariableDefinition definition) { var stLoc = OpCodeHelper.StLoc(definition.Index); return(stLoc.Equals(OpCodes.Stloc_S) ? Instruction.Create(stLoc, definition) : Instruction.Create(stLoc)); }
public static Instruction LdLoc(VariableDefinition definition) { var ldLoc = OpCodeHelper.LdLoc(definition.Index); return(ldLoc == OpCodes.Ldloc_S ? Instruction.Create(ldLoc, definition) : Instruction.Create(ldLoc)); }