summaryrefslogtreecommitdiff
path: root/src/module.cc
diff options
context:
space:
mode:
authorMarius Kintel <marius@kintel.net>2011-12-26 15:34:47 (GMT)
committerMarius Kintel <marius@kintel.net>2011-12-26 15:34:47 (GMT)
commit4ff2d1af446c1f276c644b12e6ec4cc6db0b6d65 (patch)
tree10e9e52c2483efd6149f189c21366cdb0b11de77 /src/module.cc
parentf0817a1c167c9d9f0ecf0ef8ec7bee03d61e63f2 (diff)
Some light refactoring attempts, didn't get very far..
Diffstat (limited to 'src/module.cc')
-rw-r--r--src/module.cc23
1 files changed, 14 insertions, 9 deletions
diff --git a/src/module.cc b/src/module.cc
index 269e128..ba0112d 100644
--- a/src/module.cc
+++ b/src/module.cc
@@ -68,7 +68,6 @@ std::string ModuleInstantiation::dump(const std::string &indent) const
{
std::stringstream dump;
dump << indent;
- if (!label.empty()) dump << label <<": ";
dump << modname + "(";
for (size_t i=0; i < argnames.size(); i++) {
if (i > 0) dump << ", ";
@@ -96,10 +95,11 @@ AbstractNode *ModuleInstantiation::evaluate(const Context *ctx) const
if (this->ctx) {
PRINTF("WARNING: Ignoring recursive module instantiation of '%s'.", modname.c_str());
} else {
+ // FIXME: Casting away const..
ModuleInstantiation *that = (ModuleInstantiation*)this;
that->argvalues.clear();
- BOOST_FOREACH (Expression *v, that->argexpr) {
- that->argvalues.push_back(v->evaluate(ctx));
+ BOOST_FOREACH (Expression *expr, that->argexpr) {
+ that->argvalues.push_back(expr->evaluate(ctx));
}
that->ctx = ctx;
node = ctx->evaluate_module(*this);
@@ -113,9 +113,9 @@ std::vector<AbstractNode*> ModuleInstantiation::evaluateChildren(const Context *
{
if (!ctx) ctx = this->ctx;
std::vector<AbstractNode*> childnodes;
- BOOST_FOREACH (ModuleInstantiation *v, this->children) {
- AbstractNode *n = v->evaluate(ctx);
- if (n != NULL) childnodes.push_back(n);
+ BOOST_FOREACH (ModuleInstantiation *modinst, this->children) {
+ AbstractNode *node = modinst->evaluate(ctx);
+ if (node) childnodes.push_back(node);
}
return childnodes;
}
@@ -124,9 +124,9 @@ std::vector<AbstractNode*> IfElseModuleInstantiation::evaluateElseChildren(const
{
if (!ctx) ctx = this->ctx;
std::vector<AbstractNode*> childnodes;
- BOOST_FOREACH (ModuleInstantiation *v, this->else_children) {
- AbstractNode *n = v->evaluate(this->ctx);
- if (n != NULL) childnodes.push_back(n);
+ BOOST_FOREACH (ModuleInstantiation *modinst, this->else_children) {
+ AbstractNode *node = modinst->evaluate(ctx);
+ if (node != NULL) childnodes.push_back(node);
}
return childnodes;
}
@@ -200,3 +200,8 @@ std::string Module::dump(const std::string &indent, const std::string &name) con
}
return dump.str();
}
+
+void Module::clear_library_cache()
+{
+ Module::libs_cache.clear();
+}
contact: Jan Huwald // Impressum