Expr NegateOp(DynamicMetaObject target) { var expr = LuaConvertBinder.ToNumber(target); if (expr == null) { return(MetamethodFallbacks.UnaryMinus(context, target)); } if (target.LimitType == typeof(string)) { return(FallbackIfNumberIsNan(expr)); } return(Expr.MakeUnary(Operation, Expr.Convert(expr, typeof(double)), null)); }
Expr Numeric(DynamicMetaObject left, DynamicMetaObject right) { var leftExpr = LuaConvertBinder.ToNumber(left); var rightExpr = LuaConvertBinder.ToNumber(right); if (leftExpr == null) { return(null); } if (left.LimitType == typeof(string)) { return(FallbackIfNumberIsNan(leftExpr, left, right)); } return(Expr.Convert(Expr.MakeBinary(Operation, leftExpr, rightExpr), typeof(object))); }