mirror of
https://github.com/Icinga/icinga2.git
synced 2025-07-25 14:44:32 +02:00
parent
05485ea2d6
commit
1275847d5a
@ -89,7 +89,7 @@ const DebugInfo& DebuggableExpression::GetDebugInfo(void) const
|
|||||||
|
|
||||||
Value VariableExpression::DoEvaluate(ScriptFrame& frame, DebugHint *dhint) const
|
Value VariableExpression::DoEvaluate(ScriptFrame& frame, DebugHint *dhint) const
|
||||||
{
|
{
|
||||||
return VMOps::Variable(frame, m_Variable, GetDebugInfo());
|
return VMOps::Variable(frame, m_Variable, m_DebugInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
Value NegateExpression::DoEvaluate(ScriptFrame& frame, DebugHint *dhint) const
|
Value NegateExpression::DoEvaluate(ScriptFrame& frame, DebugHint *dhint) const
|
||||||
@ -189,7 +189,7 @@ Value InExpression::DoEvaluate(ScriptFrame& frame, DebugHint *dhint) const
|
|||||||
if (right.IsEmpty())
|
if (right.IsEmpty())
|
||||||
return false;
|
return false;
|
||||||
else if (!right.IsObjectType<Array>())
|
else if (!right.IsObjectType<Array>())
|
||||||
BOOST_THROW_EXCEPTION(ScriptError("Invalid right side argument for 'in' operator: " + JsonEncode(right), GetDebugInfo()));
|
BOOST_THROW_EXCEPTION(ScriptError("Invalid right side argument for 'in' operator: " + JsonEncode(right), m_DebugInfo));
|
||||||
|
|
||||||
Value left = m_Operand1->Evaluate(frame);
|
Value left = m_Operand1->Evaluate(frame);
|
||||||
|
|
||||||
@ -204,7 +204,7 @@ Value NotInExpression::DoEvaluate(ScriptFrame& frame, DebugHint *dhint) const
|
|||||||
if (right.IsEmpty())
|
if (right.IsEmpty())
|
||||||
return true;
|
return true;
|
||||||
else if (!right.IsObjectType<Array>())
|
else if (!right.IsObjectType<Array>())
|
||||||
BOOST_THROW_EXCEPTION(ScriptError("Invalid right side argument for 'in' operator: " + JsonEncode(right), GetDebugInfo()));
|
BOOST_THROW_EXCEPTION(ScriptError("Invalid right side argument for 'in' operator: " + JsonEncode(right), m_DebugInfo));
|
||||||
|
|
||||||
Value left = m_Operand1->Evaluate(frame);
|
Value left = m_Operand1->Evaluate(frame);
|
||||||
|
|
||||||
@ -237,7 +237,7 @@ Value FunctionCallExpression::DoEvaluate(ScriptFrame& frame, DebugHint *dhint) c
|
|||||||
return Empty;
|
return Empty;
|
||||||
|
|
||||||
Value index = m_IName[i]->Evaluate(frame);
|
Value index = m_IName[i]->Evaluate(frame);
|
||||||
result = VMOps::GetField(result, index, GetDebugInfo());
|
result = VMOps::GetField(result, index, m_DebugInfo);
|
||||||
|
|
||||||
if (i == m_IName.size() - 2)
|
if (i == m_IName.size() - 2)
|
||||||
self = result;
|
self = result;
|
||||||
@ -250,7 +250,7 @@ Value FunctionCallExpression::DoEvaluate(ScriptFrame& frame, DebugHint *dhint) c
|
|||||||
vfunc = m_FName->Evaluate(frame);
|
vfunc = m_FName->Evaluate(frame);
|
||||||
|
|
||||||
if (!vfunc.IsObjectType<ScriptFunction>())
|
if (!vfunc.IsObjectType<ScriptFunction>())
|
||||||
BOOST_THROW_EXCEPTION(ScriptError("Argument is not a callable object.", GetDebugInfo()));
|
BOOST_THROW_EXCEPTION(ScriptError("Argument is not a callable object.", m_DebugInfo));
|
||||||
|
|
||||||
ScriptFunction::Ptr func = vfunc;
|
ScriptFunction::Ptr func = vfunc;
|
||||||
|
|
||||||
@ -318,7 +318,7 @@ Value SetExpression::DoEvaluate(ScriptFrame& frame, DebugHint *dhint) const
|
|||||||
object = indexExpr->Evaluate(frame, dhint);
|
object = indexExpr->Evaluate(frame, dhint);
|
||||||
|
|
||||||
if (!object)
|
if (!object)
|
||||||
BOOST_THROW_EXCEPTION(ScriptError("Left-hand side argument must not be null.", GetDebugInfo()));
|
BOOST_THROW_EXCEPTION(ScriptError("Left-hand side argument must not be null.", m_DebugInfo));
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -348,12 +348,12 @@ Value SetExpression::DoEvaluate(ScriptFrame& frame, DebugHint *dhint) const
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
object = VMOps::GetField(parent, tempindex, GetDebugInfo());
|
object = VMOps::GetField(parent, tempindex, m_DebugInfo);
|
||||||
|
|
||||||
if (i != m_Indexer.size() - 1 && object.IsEmpty()) {
|
if (i != m_Indexer.size() - 1 && object.IsEmpty()) {
|
||||||
object = new Dictionary();
|
object = new Dictionary();
|
||||||
|
|
||||||
VMOps::SetField(parent, tempindex, object);
|
VMOps::SetField(parent, tempindex, object, m_DebugInfo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -393,7 +393,7 @@ Value SetExpression::DoEvaluate(ScriptFrame& frame, DebugHint *dhint) const
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
VMOps::SetField(parent, index, right);
|
VMOps::SetField(parent, index, right, m_DebugInfo);
|
||||||
|
|
||||||
if (psdhint)
|
if (psdhint)
|
||||||
psdhint->AddMessage("=", m_DebugInfo);
|
psdhint->AddMessage("=", m_DebugInfo);
|
||||||
@ -418,18 +418,18 @@ Value ReturnExpression::DoEvaluate(ScriptFrame& frame, DebugHint *dhint) const
|
|||||||
|
|
||||||
Value IndexerExpression::DoEvaluate(ScriptFrame& frame, DebugHint *dhint) const
|
Value IndexerExpression::DoEvaluate(ScriptFrame& frame, DebugHint *dhint) const
|
||||||
{
|
{
|
||||||
return VMOps::Indexer(frame, m_Indexer, GetDebugInfo());
|
return VMOps::Indexer(frame, m_Indexer, m_DebugInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
Value ImportExpression::DoEvaluate(ScriptFrame& frame, DebugHint *dhint) const
|
Value ImportExpression::DoEvaluate(ScriptFrame& frame, DebugHint *dhint) const
|
||||||
{
|
{
|
||||||
String type = VMOps::GetField(frame.Self, "type", GetDebugInfo());
|
String type = VMOps::GetField(frame.Self, "type", m_DebugInfo);
|
||||||
Value name = m_Name->Evaluate(frame);
|
Value name = m_Name->Evaluate(frame);
|
||||||
|
|
||||||
ConfigItem::Ptr item = ConfigItem::GetObject(type, name);
|
ConfigItem::Ptr item = ConfigItem::GetObject(type, name);
|
||||||
|
|
||||||
if (!item)
|
if (!item)
|
||||||
BOOST_THROW_EXCEPTION(ScriptError("Import references unknown template: '" + name + "'", GetDebugInfo()));
|
BOOST_THROW_EXCEPTION(ScriptError("Import references unknown template: '" + name + "'", m_DebugInfo));
|
||||||
|
|
||||||
item->GetExpression()->Evaluate(frame, dhint);
|
item->GetExpression()->Evaluate(frame, dhint);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user