]> granicus.if.org Git - icinga2/commitdiff
Remove unnecessary MakeLiteral calls in SetExpression::DoEvaluate
authorGunnar Beutner <gunnar@beutner.name>
Wed, 23 Sep 2015 08:36:57 +0000 (10:36 +0200)
committerGunnar Beutner <gunnar@beutner.name>
Wed, 23 Sep 2015 08:37:13 +0000 (10:37 +0200)
fixes #10199

lib/config/expression.cpp

index 773a871a71bbfa32f012aa71947fe5141ee3d47d..5f2832f9148250deb235842a3fd7bcbd9294604f 100644 (file)
@@ -505,41 +505,30 @@ ExpressionResult SetExpression::DoEvaluate(ScriptFrame& frame, DebugHint *dhint)
        if (m_Op != OpSetLiteral) {
                Value object = VMOps::GetField(parent, index, m_DebugInfo);
 
-               Expression *lhs = MakeLiteral(object);
-               Expression *rhs = MakeLiteral(operand2);
-
                switch (m_Op) {
                        case OpSetAdd:
-                               operand2 = AddExpression(lhs, rhs, m_DebugInfo).Evaluate(frame, dhint);
-                               CHECK_RESULT(operand2);
+                               operand2 = object + operand2;
                                break;
                        case OpSetSubtract:
-                               operand2 = SubtractExpression(lhs, rhs, m_DebugInfo).Evaluate(frame, dhint);
-                               CHECK_RESULT(operand2);
+                               operand2 = object - operand2;
                                break;
                        case OpSetMultiply:
-                               operand2 = MultiplyExpression(lhs, rhs, m_DebugInfo).Evaluate(frame, dhint);
-                               CHECK_RESULT(operand2);
+                               operand2 = object * operand2;
                                break;
                        case OpSetDivide:
-                               operand2 = DivideExpression(lhs, rhs, m_DebugInfo).Evaluate(frame, dhint);
-                               CHECK_RESULT(operand2);
+                               operand2 = object / operand2;
                                break;
                        case OpSetModulo:
-                               operand2 = ModuloExpression(lhs, rhs, m_DebugInfo).Evaluate(frame, dhint);
-                               CHECK_RESULT(operand2);
+                               operand2 = object % operand2;
                                break;
                        case OpSetXor:
-                               operand2 = XorExpression(lhs, rhs, m_DebugInfo).Evaluate(frame, dhint);
-                               CHECK_RESULT(operand2);
+                               operand2 = object ^ operand2;
                                break;
                        case OpSetBinaryAnd:
-                               operand2 = BinaryAndExpression(lhs, rhs, m_DebugInfo).Evaluate(frame, dhint);
-                               CHECK_RESULT(operand2);
+                               operand2 = object & operand2;
                                break;
                        case OpSetBinaryOr:
-                               operand2 = BinaryOrExpression(lhs, rhs, m_DebugInfo).Evaluate(frame, dhint);
-                               CHECK_RESULT(operand2);
+                               operand2 = object | operand2;
                                break;
                        default:
                                VERIFY(!"Invalid opcode.");