Make sure templates are never evaluated on their own

fixes #7536
This commit is contained in:
Gunnar Beutner 2014-10-31 17:52:47 +01:00
parent 6bc2938996
commit 1811f8689b
2 changed files with 5 additions and 8 deletions

View File

@ -134,15 +134,9 @@ void ObjectListCommand::PrintObject(std::ostream& fp, bool& first, const String&
else
fp << "\n";
bool abstract = object->Get("abstract");
Dictionary::Ptr debug_hints = object->Get("debug_hints");
if (abstract)
fp << "Template '";
else
fp << "Object '";
fp << ConsoleColorTag(Console_ForegroundBlue | Console_Bold) << internal_name << ConsoleColorTag(Console_Normal) << "'";
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";
PrintProperties(fp, properties, debug_hints, 2);

View File

@ -121,6 +121,7 @@ Expression::Ptr ConfigItem::GetExpressionList(void) const
Dictionary::Ptr ConfigItem::GetProperties(void)
{
ASSERT(!OwnsLock());
VERIFY(!IsAbstract());
ObjectLock olock(this);
@ -296,11 +297,13 @@ void ConfigItem::WriteObjectsFile(const String& filename)
BOOST_FOREACH(const ItemMap::value_type& kv, m_Items) {
ConfigItem::Ptr item = kv.second;
if (item->IsAbstract())
continue;
Dictionary::Ptr persistentItem = make_shared<Dictionary>();
persistentItem->Set("type", item->GetType());
persistentItem->Set("name", item->GetName());
persistentItem->Set("abstract", item->IsAbstract());
persistentItem->Set("properties", item->GetProperties());
persistentItem->Set("debug_hints", item->GetDebugHints());