protected override Expression VisitConstant(ConstantExpression node) { var result = base.VisitConstant(node); if (node.Type == typeof(int)) { IL.Ldc((int)node.Value); } else if (node.Type == typeof(double)) { IL.Ldc((double)node.Value); } else if (node.Type == typeof(float)) { IL.Ldc((float)node.Value); } else if (node.Type == typeof(bool)) { IL.Ldc((bool)node.Value ? 1 : 0); } else { throw new NotSupportedException(); } return(result); }
public override void Emit(DynamicMethodBody generator) { generator.Ldc(Value); }