From 4896428c06297f7fd0bc9e78e192564551a836e1 Mon Sep 17 00:00:00 2001 From: Gunnar Beutner Date: Thu, 5 Feb 2015 15:05:07 +0100 Subject: [PATCH] Add path information for objects in objects file fixes #8371 --- lib/cli/objectlistcommand.cpp | 7 +++++++ lib/config/configitem.cpp | 8 ++++++++ 2 files changed, 15 insertions(+) diff --git a/lib/cli/objectlistcommand.cpp b/lib/cli/objectlistcommand.cpp index 1a9b49624..d1ed041ba 100644 --- a/lib/cli/objectlistcommand.cpp +++ b/lib/cli/objectlistcommand.cpp @@ -140,6 +140,13 @@ void ObjectListCommand::PrintObject(std::ostream& fp, bool& first, const String& fp << "Object '" << ConsoleColorTag(Console_ForegroundBlue | Console_Bold) << internal_name << ConsoleColorTag(Console_Normal) << "'"; fp << " of type '" << ConsoleColorTag(Console_ForegroundMagenta | Console_Bold) << type << ConsoleColorTag(Console_Normal) << "':\n"; + Array::Ptr di = object->Get("debug_info"); + + if (di) { + fp << ConsoleColorTag(Console_ForegroundCyan) << " % declared in '" << di->Get(0) << "', lines " + << di->Get(1) << ":" << di->Get(2) << "-" << di->Get(3) << ":" << di->Get(4) << ConsoleColorTag(Console_Normal) << "\n"; + } + PrintProperties(fp, properties, debug_hints, 2); type_count[type]++; diff --git a/lib/config/configitem.cpp b/lib/config/configitem.cpp index 4f4102a5b..0bfcddf94 100644 --- a/lib/config/configitem.cpp +++ b/lib/config/configitem.cpp @@ -214,6 +214,14 @@ DynamicObject::Ptr ConfigItem::Commit(bool discard) persistentItem->Set("properties", attrs); persistentItem->Set("debug_hints", debugHints.ToDictionary()); + Array::Ptr di = new Array(); + di->Add(m_DebugInfo.Path); + di->Add(m_DebugInfo.FirstLine); + di->Add(m_DebugInfo.FirstColumn); + di->Add(m_DebugInfo.LastLine); + di->Add(m_DebugInfo.LastColumn); + persistentItem->Set("debug_info", di); + ConfigCompilerContext::GetInstance()->WriteObject(persistentItem); persistentItem.reset();