aboutsummaryrefslogtreecommitdiff
path: root/lib/ast.js
diff options
context:
space:
mode:
authorAlex Lam S.L <alexlamsl@gmail.com>2017-04-22 22:15:04 +0800
committerGitHub <noreply@github.com>2017-04-22 22:15:04 +0800
commitca32a09032b3e7d6aac1f0b01f67a0b67b3037f1 (patch)
tree217bb3ff8638d97552cf86a16118377eb62f8191 /lib/ast.js
parent6f954aa3d0a505791753c6cb6273e98d84895915 (diff)
downloadtracifyjs-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.js9
1 files changed, 5 insertions, 4 deletions
diff --git a/lib/ast.js b/lib/ast.js
index 739c21c2..e61a31e5 100644
--- a/lib/ast.js
+++ b/lib/ast.js
@@ -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);
}
}));
}