The handling of hoisted nodes in class bodies was incorrect, as the node
was being unwrapped *before* checking if it was hoisted, meaning nodes
that should have been hoisted would be output normally.

This affected `PassthroughLiteral`s as they were wrapped in a `Value`.
This commit is contained in:
Chris Connelly
2017-10-07 19:32:43 +01:00
committed by Geoffrey Booth
parent 22fb31e317
commit 4d4e47bfb2
3 changed files with 21 additions and 8 deletions

View File

@@ -701,6 +701,12 @@
ref1 = this.expressions;
for (index = j = 0, len1 = ref1.length; j < len1; index = ++j) {
node = ref1[index];
if (node.hoisted) {
// This is a hoisted expression.
// We want to compile this and ignore the result.
node.compileToFragments(o);
continue;
}
node = node.unwrapAll();
node = node.unfoldSoak(o) || node;
if (node instanceof Block) {
@@ -708,10 +714,6 @@
// enclose it in a new scope; we just compile the statements in this
// block along with our own.
compiledNodes.push(node.compileNode(o));
} else if (node.hoisted) {
// This is a hoisted expression.
// We want to compile this and ignore the result.
node.compileToFragments(o);
} else if (top) {
node.front = true;
fragments = node.compileToFragments(o);