diff options
author | Marius Kintel <marius@kintel.net> | 2011-12-26 20:20:05 (GMT) |
---|---|---|
committer | Marius Kintel <marius@kintel.net> | 2011-12-26 20:20:05 (GMT) |
commit | cde24f681580f8911ac4fe29265b169a0bac5f49 (patch) | |
tree | b426b377e367a50b406bad51a0dbb76510278102 /src/context.cc | |
parent | 36056e27f34a6049c18e49d5f24bfbd7cc6eabf4 (diff) | |
parent | bc3454f369a21cd689f42f5e9ec5cb316f9ebdd5 (diff) |
Merge branch 'master' into buildfix
Diffstat (limited to 'src/context.cc')
-rw-r--r-- | src/context.cc | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/src/context.cc b/src/context.cc index 6d0cb3a..f636b05 100644 --- a/src/context.cc +++ b/src/context.cc @@ -45,6 +45,7 @@ Context::Context(const Context *parent, const Module *library) ctx_stack.push_back(this); if (parent) document_path = parent->document_path; if (library) { + // FIXME: Don't access module members directly this->functions_p = &library->functions; this->modules_p = &library->modules; this->usedlibs_p = &library->usedlibs; @@ -148,24 +149,24 @@ Value Context::evaluate_function(const std::string &name, AbstractNode *Context::evaluate_module(const ModuleInstantiation &inst) const { - if (this->modules_p && this->modules_p->find(inst.modname) != this->modules_p->end()) { - AbstractModule *m = this->modules_p->find(inst.modname)->second; - std::string replacement = Builtins::instance()->isDeprecated(inst.modname); + if (this->modules_p && this->modules_p->find(inst.name()) != this->modules_p->end()) { + AbstractModule *m = this->modules_p->find(inst.name())->second; + std::string replacement = Builtins::instance()->isDeprecated(inst.name()); if (!replacement.empty()) { - PRINTF("DEPRECATED: The %s() module will be removed in future releases. Use %s() instead.", inst.modname.c_str(), replacement.c_str()); + PRINTF("DEPRECATED: The %s() module will be removed in future releases. Use %s() instead.", inst.name().c_str(), replacement.c_str()); } return m->evaluate(this, &inst); } if (this->usedlibs_p) { BOOST_FOREACH(const ModuleContainer::value_type &m, *this->usedlibs_p) { - if (m.second->modules.find(inst.modname) != m.second->modules.end()) { + if (m.second->modules.find(inst.name()) != m.second->modules.end()) { Context ctx(this->parent, m.second); - return m.second->modules[inst.modname]->evaluate(&ctx, &inst); + return m.second->modules[inst.name()]->evaluate(&ctx, &inst); } } } if (this->parent) return this->parent->evaluate_module(inst); - PRINTF("WARNING: Ignoring unknown module '%s'.", inst.modname.c_str()); + PRINTF("WARNING: Ignoring unknown module '%s'.", inst.name().c_str()); return NULL; } |