From 3612db6a2f0017268b507949a82d8a1db4ee2934 Mon Sep 17 00:00:00 2001 From: Marius Kintel Date: Mon, 24 Nov 2014 20:44:39 -0500 Subject: [PATCH] Fixes crash during the second run of a failing recursive module --- src/localscope.cc | 22 +--------------------- 1 file changed, 1 insertion(+), 21 deletions(-) diff --git a/src/localscope.cc b/src/localscope.cc index 4f31a54b..e8f9947c 100644 --- a/src/localscope.cc +++ b/src/localscope.cc @@ -42,33 +42,13 @@ std::string LocalScope::dump(const std::string &indent) const return dump.str(); } -// FIXME: Two parameters here is a hack. Rather have separate types of scopes, or check the type of the first parameter. Note const vs. non-const std::vector LocalScope::instantiateChildren(const Context *evalctx, FileContext *filectx) const { - Context *c = filectx; - - if (!c) { - c = new Context(evalctx); - - // FIXME: If we make c a ModuleContext, child() doesn't work anymore - // c->functions_p = &this->functions; - // c->modules_p = &this->modules; - - // Uncommenting the following would allow assignments in local scopes, - // but would cause duplicate evaluation of module scopes - // BOOST_FOREACH (const Assignment &ass, this->assignments) { - // c->set_variable(ass.first, ass.second->evaluate(c)); - // } - } - std::vector childnodes; BOOST_FOREACH (ModuleInstantiation *modinst, this->children) { - AbstractNode *node = modinst->evaluate(c); + AbstractNode *node = modinst->evaluate(filectx ? filectx : evalctx); if (node) childnodes.push_back(node); } - if (c != filectx) delete c; - return childnodes; } -