From: Gunnar Beutner Date: Mon, 24 Mar 2014 10:34:41 +0000 (+0100) Subject: Remove __parent element for +=, -=, *= and /= operators. X-Git-Tag: v0.0.9~34^2~1 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=013690e4867fc938e7e56b75d641233919f76a08;p=icinga2 Remove __parent element for +=, -=, *= and /= operators. Refs #5846 --- diff --git a/lib/config/aexpression.cpp b/lib/config/aexpression.cpp index 74c1ed570..3933efd92 100644 --- a/lib/config/aexpression.cpp +++ b/lib/config/aexpression.cpp @@ -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; diff --git a/lib/config/configitem.cpp b/lib/config/configitem.cpp index fe97ab0ae..8668dbf3c 100644 --- a/lib/config/configitem.cpp +++ b/lib/config/configitem.cpp @@ -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;