internal override FluentEmitter EmitLdcI4(FluentEmitter method) { if (Number > int.MaxValue || Number < int.MinValue) { throw new OverflowException("can not convert long or ulong to int32. number is greater than Int32.MaxValue or smaller than Int32.MinValue"); } return(new MagicNumberArgumentI4(unchecked ((int)Number)).EmitLdc(method)); }
internal override FluentEmitter EmitLdc(FluentEmitter method) { switch (Number) { case -1: return method.Emit(OpCodes.Ldc_I4_M1); case 0: return method.Emit(OpCodes.Ldc_I4_0); case 1: return method.Emit(OpCodes.Ldc_I4_1); case 2: return method.Emit(OpCodes.Ldc_I4_2); case 3: return method.Emit(OpCodes.Ldc_I4_3); case 4: return method.Emit(OpCodes.Ldc_I4_4); case 5: return method.Emit(OpCodes.Ldc_I4_5); case 6: return method.Emit(OpCodes.Ldc_I4_6); case 7: return method.Emit(OpCodes.Ldc_I4_7); case 8: return method.Emit(OpCodes.Ldc_I4_8); } if (Number < sbyte.MinValue || Number > sbyte.MaxValue) return method.Emit(OpCodes.Ldc_I4, Number); return method.Emit(OpCodes.Ldc_I4_S, (sbyte) Number); }
internal override FluentEmitter EmitLdc(FluentEmitter method) { return method.Emit(OpCodes.Ldc_R4, Number); }
internal override FluentEmitter EmitLdcI4(FluentEmitter method) { if(Number > int.MaxValue || Number < int.MinValue) throw new OverflowException("can not convert long or ulong to int32. number is greater than Int32.MaxValue or smaller than Int32.MinValue"); return new MagicNumberArgumentI4(unchecked((int)Number)).EmitLdc(method); }
internal override FluentEmitter EmitLdcR8(FluentEmitter method) { return new MagicNumberArgumentR8(Number).EmitLdc(method); }
internal override FluentEmitter EmitLdcI4(FluentEmitter method) { return EmitLdc(method); }
internal override FluentEmitter EmitLdc(FluentEmitter method) { return method.Emit(Number ? OpCodes.Ldc_I4_1 : OpCodes.Ldc_I4_0); }
internal override FluentEmitter EmitLdcR4(FluentEmitter method) { return EmitLdc(method); }
internal override FluentEmitter EmitLdcI8(FluentEmitter method) { return(new MagicNumberArgumentI8((long)Number).EmitLdc(method)); }
internal override FluentEmitter EmitLdc(FluentEmitter method) { return(method.Emit(OpCodes.Ldc_R8, Number)); }
internal override FluentEmitter EmitLdcR8(FluentEmitter method) { return(new MagicNumberArgumentR8(Number ? 1.0d : 0.0d).EmitLdc(method)); }
internal override FluentEmitter EmitLdc(FluentEmitter method) { return(method.Emit(Number ? OpCodes.Ldc_I4_1 : OpCodes.Ldc_I4_0)); }
public static int ComputeCodeSize(this FluentEmitter method) { return(method.Body.ComputeCodeSize()); }
internal override FluentEmitter EmitLdcR4(FluentEmitter method) { return new MagicNumberArgumentR4(Number ? 1.0f : 0.0f).EmitLdc(method); }
internal override FluentEmitter EmitLdcI4(FluentEmitter method) { return new MagicNumberArgumentI4((int) Number).EmitLdc(method); }
internal override FluentEmitter EmitLdcI8(FluentEmitter method) { return new MagicNumberArgumentI8((long) Number).EmitLdc(method); }
internal override FluentEmitter EmitLdcR4(FluentEmitter method) { return(new MagicNumberArgumentR4((float)Number).EmitLdc(method)); }
internal override FluentEmitter EmitLdcR8(FluentEmitter method) { return(EmitLdc(method)); }