mirror of https://github.com/Icinga/icinga2.git
Avoid setting up unnecessary stack frames for dictionary expressions
This commit is contained in:
parent
a28369593a
commit
1c7e7dac60
|
@ -441,29 +441,32 @@ ExpressionResult ArrayExpression::DoEvaluate(ScriptFrame& frame, DebugHint *dhin
|
||||||
|
|
||||||
ExpressionResult DictExpression::DoEvaluate(ScriptFrame& frame, DebugHint *dhint) const
|
ExpressionResult DictExpression::DoEvaluate(ScriptFrame& frame, DebugHint *dhint) const
|
||||||
{
|
{
|
||||||
ScriptFrame *dframe;
|
Value self;
|
||||||
ScriptFrame rframe;
|
|
||||||
|
|
||||||
if (!m_Inline) {
|
if (!m_Inline) {
|
||||||
dframe = &rframe;
|
self = frame.Self;
|
||||||
rframe.Locals = frame.Locals;
|
frame.Self = new Dictionary();
|
||||||
rframe.Self = new Dictionary();
|
|
||||||
} else {
|
|
||||||
dframe = &frame;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Value result;
|
Value result;
|
||||||
|
|
||||||
|
try {
|
||||||
BOOST_FOREACH(Expression *aexpr, m_Expressions) {
|
BOOST_FOREACH(Expression *aexpr, m_Expressions) {
|
||||||
ExpressionResult element = aexpr->Evaluate(*dframe, dhint);
|
ExpressionResult element = aexpr->Evaluate(frame, dhint);
|
||||||
CHECK_RESULT(element);
|
CHECK_RESULT(element);
|
||||||
result = element.GetValue();
|
result = element.GetValue();
|
||||||
}
|
}
|
||||||
|
} catch (...) {
|
||||||
|
std::swap(self, frame.Self);
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
|
||||||
if (m_Inline)
|
if (m_Inline)
|
||||||
return result;
|
return result;
|
||||||
else
|
else {
|
||||||
return dframe->Self;
|
std::swap(self, frame.Self);
|
||||||
|
return self;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ExpressionResult GetScopeExpression::DoEvaluate(ScriptFrame& frame, DebugHint *dhint) const
|
ExpressionResult GetScopeExpression::DoEvaluate(ScriptFrame& frame, DebugHint *dhint) const
|
||||||
|
|
Loading…
Reference in New Issue