Add missing DebugInfo for field accesses

refs #8062
This commit is contained in:
Gunnar Beutner 2014-12-12 08:58:39 +01:00
parent b016003eb5
commit a94b26ff47
3 changed files with 8 additions and 4 deletions

View File

@ -41,6 +41,10 @@ struct DebugInfo
int LastLine;
int LastColumn;
DebugInfo(void)
: FirstLine(0), FirstColumn(0), LastLine(0), LastColumn(0)
{ }
};
I2_BASE_API std::ostream& operator<<(std::ostream& out, const DebugInfo& val);

View File

@ -89,7 +89,7 @@ const DebugInfo& DebuggableExpression::GetDebugInfo(void) const
Value VariableExpression::DoEvaluate(VMFrame& frame, DebugHint *dhint) const
{
return VMOps::Variable(frame, m_Variable);
return VMOps::Variable(frame, m_Variable, GetDebugInfo());
}
Value NegateExpression::DoEvaluate(VMFrame& frame, DebugHint *dhint) const
@ -419,7 +419,7 @@ Value ReturnExpression::DoEvaluate(VMFrame& frame, DebugHint *dhint) const
Value IndexerExpression::DoEvaluate(VMFrame& frame, DebugHint *dhint) const
{
return VMOps::Indexer(frame, m_Indexer);
return VMOps::Indexer(frame, m_Indexer, GetDebugInfo());
}
Value ImportExpression::DoEvaluate(VMFrame& frame, DebugHint *dhint) const

View File

@ -45,7 +45,7 @@ namespace icinga
class VMOps
{
public:
static inline Value Variable(VMFrame& frame, const String& name)
static inline Value Variable(VMFrame& frame, const String& name, const DebugInfo& debugInfo = DebugInfo())
{
if (name == "this")
return frame.Self;
@ -53,7 +53,7 @@ public:
if (frame.Locals && frame.Locals->Contains(name))
return frame.Locals->Get(name);
else if (frame.Locals != frame.Self && HasField(frame.Self, name))
return GetField(frame.Self, name);
return GetField(frame.Self, name, debugInfo);
else
return ScriptVariable::Get(name);
}