fix deep cloning of labels (#1565)

`AST_Label.references` get `.initialize()` to `[]` every time after `.clone()`

So walk down the tree to pick up the cloned `AST_LoopControl` pieces and put it back together.
This commit is contained in:
Alex Lam S.L
2017-03-07 18:38:27 +08:00
committed by GitHub
parent 8153b7bd8a
commit 8a8a94a596
2 changed files with 47 additions and 1 deletions

View File

@@ -1093,3 +1093,32 @@ func_modified: {
}
}
}
defun_label: {
options = {
passes: 2,
reduce_vars: true,
unused: true,
}
input: {
!function() {
function f(a) {
L: {
if (a) break L;
return 1;
}
}
console.log(f(2));
}();
}
expect: {
!function() {
console.log(function(a) {
L: {
if (a) break L;
return 1;
}
}(2));
}();
}
}