]> granicus.if.org Git - icinga2/commitdiff
Some more variable scoping fixes.
authorGunnar Beutner <gunnar.beutner@netways.de>
Mon, 24 Mar 2014 08:44:18 +0000 (09:44 +0100)
committerGunnar Beutner <gunnar.beutner@netways.de>
Mon, 24 Mar 2014 08:44:18 +0000 (09:44 +0100)
Refs #5846

lib/config/aexpression.cpp

index e09be8de8255843fa18f02d09cc8be1344c1e170..5a56aa4231a1d4a5adc4320b3b07451ae324e1d9 100644 (file)
@@ -357,9 +357,14 @@ Value AExpression::OpSetPlus(const AExpression *expr, const Dictionary::Ptr& loc
 
                if (!xlocals)
                        xlocals = make_shared<Dictionary>();
+
+               xlocals->Set("__parent", locals);
        }
 
        Value result = left + expr->EvaluateOperand2(xlocals);
+
+       xlocals->Remove("__parent");
+
        locals->Set(expr->m_Operand1, result);
        return result;
 }
@@ -375,9 +380,14 @@ Value AExpression::OpSetMinus(const AExpression *expr, const Dictionary::Ptr& lo
 
                if (!xlocals)
                        xlocals = make_shared<Dictionary>();
+
+               xlocals->Set("__parent", locals);
        }
 
        Value result = left - expr->EvaluateOperand2(xlocals);
+
+       xlocals->Remove("__parent");
+
        locals->Set(expr->m_Operand1, result);
        return result;
 }
@@ -393,9 +403,14 @@ Value AExpression::OpSetMultiply(const AExpression *expr, const Dictionary::Ptr&
 
                if (!xlocals)
                        xlocals = make_shared<Dictionary>();
+
+               xlocals->Set("__parent", locals);
        }
 
        Value result = left * expr->EvaluateOperand2(xlocals);
+
+       xlocals->Remove("__parent");
+
        locals->Set(expr->m_Operand1, result);
        return result;
 }
@@ -411,9 +426,14 @@ Value AExpression::OpSetDivide(const AExpression *expr, const Dictionary::Ptr& l
 
                if (!xlocals)
                        xlocals = make_shared<Dictionary>();
+
+               xlocals->Set("__parent", locals);
        }
 
        Value result = left / expr->EvaluateOperand2(xlocals);
+
+       xlocals->Remove("__parent");
+
        locals->Set(expr->m_Operand1, result);
        return result;
 }