Skip to content

Commit

Permalink
Fix issue #1576, local scope assigments in groups.
Browse files Browse the repository at this point in the history
  • Loading branch information
thehans committed Feb 28, 2018
1 parent 21f67de commit 0b7bfb2
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
7 changes: 3 additions & 4 deletions src/GroupModule.cc
Expand Up @@ -32,11 +32,10 @@

AbstractNode *GroupModule::instantiate(const Context *ctx, const ModuleInstantiation *inst, EvalContext *evalctx) const
{
(void)ctx; // avoid unusued parameter warning

auto node = new GroupNode(inst);

node->children = inst->instantiateChildren(evalctx);
inst->scope.apply(*evalctx);
auto instantiatednodes = inst->instantiateChildren(evalctx);
node->children.insert(node->children.end(), instantiatednodes.begin(), instantiatednodes.end());

return node;
}
Expand Down
6 changes: 5 additions & 1 deletion testdata/scad/misc/scope-assignment-tests.scad
Expand Up @@ -15,7 +15,6 @@ module mymodule(b=6) {
mymodule();
mymodule(8);


echo("module children scope:");
module mymodule2(b2=6) {
b2 = 2;
Expand Down Expand Up @@ -83,3 +82,8 @@ assign(i=9) {
echo("i (10)", i);
}

echo("group scope:");
group() {
a=11;
echo("local a (11)", a);
}
Expand Up @@ -28,3 +28,5 @@ ECHO: "h (undef)", undef
ECHO: "override variable in assign scope:"
DEPRECATED: The assign() module will be removed in future releases. Use a regular assignment instead.
ECHO: "i (10)", 10
ECHO: "group scope:"
ECHO: "local a (11)", 11

0 comments on commit 0b7bfb2

Please sign in to comment.