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:
@@ -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));
|
||||
}();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user