} // ctor public override DynamicMetaObject FallbackBinaryOperation(DynamicMetaObject target, DynamicMetaObject arg, DynamicMetaObject errorSuggestion) { // defer target and all arguments if (!target.HasValue || !arg.HasValue) { return(Defer(target, arg)); } Expression expr; try { expr = EnsureType(LuaEmit.BinaryOperationExpression(lua, lInteger && Operation == ExpressionType.Divide ? Lua.IntegerDivide : Operation, target.Expression, target.LimitType, arg.Expression, arg.LimitType, false), this.ReturnType); } catch (LuaEmitException e) { if (errorSuggestion != null) { return(errorSuggestion); } expr = ThrowExpression(e.Message, this.ReturnType); } // restrictions var restrictions = target.Restrictions .Merge(arg.Restrictions) .Merge(Lua.GetSimpleRestriction(target)) .Merge(Lua.GetSimpleRestriction(arg)); return(new DynamicMetaObject(expr, restrictions)); } // func FallbackBinaryOperation
} // func UnaryOperationExpression private static Expression BinaryOperationExpression(Lua runtime, Token tStart, ExpressionType op, Expression expr1, Expression expr2) { expr1 = ConvertObjectExpression(runtime, tStart, expr1); expr2 = ConvertObjectExpression(runtime, tStart, expr2); return(SafeExpression(() => LuaEmit.BinaryOperationExpression(runtime, op, expr1, expr1.Type, expr2, expr2.Type, true), tStart)); } // func BinaryOperationExpression