diff options
author | Alex Lam S.L <alexlamsl@gmail.com> | 2017-03-07 18:38:27 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-03-07 18:38:27 +0800 |
commit | 8a8a94a596f57981e2cc65ac37921b154a9992b7 (patch) | |
tree | e5c9557bb57e12a2c3155fb0ab3d7ed0e3105c7a /test | |
parent | 8153b7bd8a70ad94666904bd41f12ebd6be684c8 (diff) | |
download | tracifyjs-8a8a94a596f57981e2cc65ac37921b154a9992b7.tar.gz tracifyjs-8a8a94a596f57981e2cc65ac37921b154a9992b7.zip |
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.
Diffstat (limited to 'test')
-rw-r--r-- | test/compress/reduce_vars.js | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/test/compress/reduce_vars.js b/test/compress/reduce_vars.js index a373de29..53e28152 100644 --- a/test/compress/reduce_vars.js +++ b/test/compress/reduce_vars.js @@ -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)); + }(); + } +} |