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

Method BindToScope

lib/config/expression.cpp:803–842  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

801}
802
803void icinga::BindToScope(std::unique_ptr<Expression>& expr, ScopeSpecifier scopeSpec)
804{
805 auto *dexpr = dynamic_cast<DictExpression *>(expr.get());
806
807 if (dexpr) {
808 for (auto& expr : dexpr->m_Expressions)
809 BindToScope(expr, scopeSpec);
810
811 return;
812 }
813
814 auto *aexpr = dynamic_cast<SetExpression *>(expr.get());
815
816 if (aexpr) {
817 BindToScope(aexpr->m_Operand1, scopeSpec);
818
819 return;
820 }
821
822 auto *iexpr = dynamic_cast<IndexerExpression *>(expr.get());
823
824 if (iexpr) {
825 BindToScope(iexpr->m_Operand1, scopeSpec);
826 return;
827 }
828
829 auto *lexpr = dynamic_cast<LiteralExpression *>(expr.get());
830
831 if (lexpr && lexpr->GetValue().IsString()) {
832 std::unique_ptr<Expression> scope{new GetScopeExpression(scopeSpec)};
833 expr.reset(new IndexerExpression(std::move(scope), std::move(expr), lexpr->GetDebugInfo()));
834 }
835
836 auto *vexpr = dynamic_cast<VariableExpression *>(expr.get());
837
838 if (vexpr) {
839 std::unique_ptr<Expression> scope{new GetScopeExpression(scopeSpec)};
840 expr.reset(new IndexerExpression(std::move(scope), MakeLiteral(vexpr->GetVariable()), vexpr->GetDebugInfo()));
841 }
842}
843
844ExpressionResult ThrowExpression::DoEvaluate(ScriptFrame& frame, DebugHint*) const
845{

Callers

nothing calls this directly

Calls 6

MakeLiteralFunction · 0.85
IsStringMethod · 0.80
GetVariableMethod · 0.80
getMethod · 0.45
GetValueMethod · 0.45
GetDebugInfoMethod · 0.45

Tested by

no test coverage detected