Fix validation problem with relative object names.

Refs #5925
This commit is contained in:
Gunnar Beutner 2014-04-05 22:53:44 +02:00 committed by Gunnar Beutner
parent 2156154ce4
commit bc4cacfee9
1 changed files with 16 additions and 5 deletions

View File

@ -522,6 +522,16 @@ Value AExpression::OpObject(const AExpression* expr, const Dictionary::Ptr& loca
ConfigItemBuilder::Ptr item = make_shared<ConfigItemBuilder>(expr->m_DebugInfo);
String checkName = name;
if (!abstract) {
const DynamicObjectNameHelper *nh = dynamic_cast<const DynamicObjectNameHelper *>(Type::GetByName(type));
if (nh)
checkName = nh->MakeObjectName(name, Dictionary::Ptr());
}
if (!checkName.IsEmpty()) {
ConfigItem::Ptr oldItem = ConfigItem::GetObject(type, name);
if (oldItem) {
@ -529,6 +539,7 @@ Value AExpression::OpObject(const AExpression* expr, const Dictionary::Ptr& loca
msgbuf << "Object '" << name << "' of type '" << type << "' re-defined: " << expr->m_DebugInfo << "; previous definition: " << oldItem->GetDebugInfo();
BOOST_THROW_EXCEPTION(ConfigError(msgbuf.str()) << errinfo_debuginfo(expr->m_DebugInfo));
}
}
item->SetType(type);