From a94b26ff47b2be00cdd726389608789554aa45f8 Mon Sep 17 00:00:00 2001 From: Gunnar Beutner Date: Fri, 12 Dec 2014 08:58:39 +0100 Subject: [PATCH] Add missing DebugInfo for field accesses refs #8062 --- lib/base/debuginfo.hpp | 4 ++++ lib/config/expression.cpp | 4 ++-- lib/config/vmops.hpp | 4 ++-- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/lib/base/debuginfo.hpp b/lib/base/debuginfo.hpp index ae55370c3..3937c78da 100644 --- a/lib/base/debuginfo.hpp +++ b/lib/base/debuginfo.hpp @@ -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); diff --git a/lib/config/expression.cpp b/lib/config/expression.cpp index d0c273bb6..acd794e3b 100644 --- a/lib/config/expression.cpp +++ b/lib/config/expression.cpp @@ -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 diff --git a/lib/config/vmops.hpp b/lib/config/vmops.hpp index bfbb1f10d..3673dc64d 100644 --- a/lib/config/vmops.hpp +++ b/lib/config/vmops.hpp @@ -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); }