]> granicus.if.org Git - icinga2/commitdiff
Remove __parent element for +=, -=, *= and /= operators.
authorGunnar Beutner <gunnar.beutner@netways.de>
Mon, 24 Mar 2014 10:34:41 +0000 (11:34 +0100)
committerGunnar Beutner <gunnar.beutner@netways.de>
Mon, 24 Mar 2014 10:34:41 +0000 (11:34 +0100)
Refs #5846

lib/config/aexpression.cpp
lib/config/configitem.cpp

index 74c1ed57027b466b196310eda2dc2f7dbca741c6..3933efd927caa408dd8afc2f026dc5d0c27919ba 100644 (file)
@@ -368,7 +368,10 @@ Value AExpression::OpSetPlus(const AExpression *expr, const Dictionary::Ptr& loc
 
        Value result = left + expr->EvaluateOperand2(xlocals);
 
-       xlocals->Remove("__parent");
+       if (exp_right->m_Operator == &AExpression::OpDict) {
+               Dictionary::Ptr dict = result;
+               dict->Remove("__parent");
+       }
 
        locals->Set(expr->m_Operand1, result);
        return result;
@@ -391,7 +394,10 @@ Value AExpression::OpSetMinus(const AExpression *expr, const Dictionary::Ptr& lo
 
        Value result = left - expr->EvaluateOperand2(xlocals);
 
-       xlocals->Remove("__parent");
+       if (exp_right->m_Operator == &AExpression::OpDict) {
+               Dictionary::Ptr dict = result;
+               dict->Remove("__parent");
+       }
 
        locals->Set(expr->m_Operand1, result);
        return result;
@@ -414,7 +420,10 @@ Value AExpression::OpSetMultiply(const AExpression *expr, const Dictionary::Ptr&
 
        Value result = left * expr->EvaluateOperand2(xlocals);
 
-       xlocals->Remove("__parent");
+       if (exp_right->m_Operator == &AExpression::OpDict) {
+               Dictionary::Ptr dict = result;
+               dict->Remove("__parent");
+       }
 
        locals->Set(expr->m_Operand1, result);
        return result;
@@ -437,7 +446,10 @@ Value AExpression::OpSetDivide(const AExpression *expr, const Dictionary::Ptr& l
 
        Value result = left / expr->EvaluateOperand2(xlocals);
 
-       xlocals->Remove("__parent");
+       if (exp_right->m_Operator == &AExpression::OpDict) {
+               Dictionary::Ptr dict = result;
+               dict->Remove("__parent");
+       }
 
        locals->Set(expr->m_Operand1, result);
        return result;
index fe97ab0ae08971a70bd2fb69150a08e2f2a901ac..8668dbf3c808c2860879a277f1d8c0ff8aa4b31f 100644 (file)
@@ -157,6 +157,8 @@ Dictionary::Ptr ConfigItem::GetProperties(void)
                m_Properties->Set("__parent", m_Scope);
                GetLinkedExpressionList()->Evaluate(m_Properties);
                m_Properties->Remove("__parent");
+
+               VERIFY(m_Properties->Get("__type") == GetType() && m_Properties->Get("__name") == GetName());
        }
 
        return m_Properties;