Fixed code gen bug with nested templates.

This commit is contained in:
Gunnar Beutner 2012-06-06 20:33:25 +02:00
parent 3e2b5d5269
commit 029dc35366
4 changed files with 9 additions and 11 deletions

View File

@ -8,8 +8,8 @@ SUBDIRS = \
third-party \
base \
dyn \
dyntest \
jsonrpc \
dyntest \
icinga \
components \
icinga-app \

View File

@ -56,10 +56,8 @@ void ConfigItem::AddParent(string parent)
m_Parents.push_back(parent);
}
Dictionary::Ptr ConfigItem::CalculateProperties(void) const
void ConfigItem::CalculateProperties(Dictionary::Ptr dictionary) const
{
Dictionary::Ptr result = make_shared<Dictionary>();
vector<string>::const_iterator it;
for (it = m_Parents.begin(); it != m_Parents.end(); it++) {
ConfigItem::Ptr parent = ConfigItem::GetObject(GetType(), *it);
@ -70,12 +68,10 @@ Dictionary::Ptr ConfigItem::CalculateProperties(void) const
throw domain_error(message.str());
}
parent->GetExpressionList()->Execute(result);
parent->CalculateProperties(dictionary);
}
m_ExpressionList->Execute(result);
return result;
m_ExpressionList->Execute(dictionary);
}
ObjectSet<ConfigItem::Ptr>::Ptr ConfigItem::GetAllObjects(void)
@ -122,7 +118,9 @@ void ConfigItem::Commit(void)
m_DynamicObject = dobj;
}
dobj->SetConfig(CalculateProperties());
Dictionary::Ptr properties = make_shared<Dictionary>();
CalculateProperties(properties);
dobj->SetConfig(properties);
dobj->Commit();
ConfigItem::Ptr ci = GetObject(GetType(), GetName());

View File

@ -41,7 +41,7 @@ public:
ExpressionList::Ptr GetExpressionList(void) const;
void SetExpressionList(const ExpressionList::Ptr& exprl);
Dictionary::Ptr CalculateProperties(void) const;
void CalculateProperties(Dictionary::Ptr dictionary) const;
void Commit(void);
void Unregister(void);

View File

@ -10,7 +10,7 @@ int main(int argc, char **argv)
return 1;
}
for (int i = 0; i < 10; i++) {
for (int i = 0; i < 10000; i++) {
vector<ConfigItem::Ptr> objects = ConfigCompiler::CompileFile(string(argv[1]));
ConfigVM::ExecuteItems(objects);