MCPcopy Create free account
hub / github.com/Icinga/icinga2 / Evaluate

Method Evaluate

lib/config/expression.cpp:40–65  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

38}
39
40ExpressionResult Expression::Evaluate(ScriptFrame& frame, DebugHint *dhint) const
41{
42 try {
43#ifdef I2_DEBUG
44/* std::ostringstream msgbuf;
45 ShowCodeLocation(msgbuf, GetDebugInfo(), false);
46 Log(LogDebug, "Expression")
47 << "Executing:\n" << msgbuf.str();*/
48#endif /* I2_DEBUG */
49
50 frame.IncreaseStackDepth();
51
52 Defer decreaseStackDepth([&frame]{
53 frame.DecreaseStackDepth();
54 });
55
56 ExpressionResult result = DoEvaluate(frame, dhint);
57 return result;
58 } catch (ScriptError& ex) {
59 ScriptBreakpoint(frame, &ex, GetDebugInfo());
60 throw;
61 } catch (const std::exception& ex) {
62 BOOST_THROW_EXCEPTION(ScriptError("Error while evaluating expression: " + String(ex.what()), GetDebugInfo())
63 << boost::errinfo_nested_exception(boost::current_exception()));
64 }
65}
66
67bool Expression::GetReference(ScriptFrame&, [[maybe_unused]] bool init_dict, [[maybe_unused]] Value* parent, [[maybe_unused]] String* index, DebugHint**) const
68{

Callers 15

ExecuteScriptHelperMethod · 0.80
EvaluateFilterMethod · 0.80
CreateObjectMethod · 0.80
ExecuteExpressionFunction · 0.80
dbg_evalFunction · 0.80
dbg_eval_with_valueFunction · 0.80
dbg_eval_with_objectFunction · 0.80
RunScriptConsoleMethod · 0.80
EvaluateObjectRuleMethod · 0.80
EvaluateApplyRuleMethod · 0.80
EvaluateObjectRuleMethod · 0.80

Calls 5

ScriptErrorClass · 0.85
IncreaseStackDepthMethod · 0.80
DecreaseStackDepthMethod · 0.80
StringClass · 0.50
whatMethod · 0.45

Tested by

no test coverage detected