diff options
author | Alex Lam S.L <alexlamsl@gmail.com> | 2017-04-22 22:15:04 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-04-22 22:15:04 +0800 |
commit | ca32a09032b3e7d6aac1f0b01f67a0b67b3037f1 (patch) | |
tree | 217bb3ff8638d97552cf86a16118377eb62f8191 /lib/ast.js | |
parent | 6f954aa3d0a505791753c6cb6273e98d84895915 (diff) | |
download | tracifyjs-ca32a09032b3e7d6aac1f0b01f67a0b67b3037f1.tar.gz tracifyjs-ca32a09032b3e7d6aac1f0b01f67a0b67b3037f1.zip |
fix label-related bugs (#1835)
- deep cloning of `AST_LabeledStatement`
- `L:do{...}while(false)`
- empty statement with label within block
extend `test/ufuzz.js`
- generate labels for blocks & loops
- generate for-in statements
- skip suspicious option search if `minify()` errs
fixes #1833
Diffstat (limited to 'lib/ast.js')
-rw-r--r-- | lib/ast.js | 9 |
1 files changed, 5 insertions, 4 deletions
@@ -206,12 +206,13 @@ var AST_LabeledStatement = DEFNODE("LabeledStatement", "label", { clone: function(deep) { var node = this._clone(deep); if (deep) { - var refs = node.label.references; - var label = this.label; + var label = node.label; + var def = this.label; node.walk(new TreeWalker(function(node) { if (node instanceof AST_LoopControl - && node.label && node.label.thedef === label) { - refs.push(node); + && node.label && node.label.thedef === def) { + node.label.thedef = label; + label.references.push(node); } })); } |