aboutsummaryrefslogtreecommitdiff
path: root/lib/ast.js
diff options
context:
space:
mode:
authorAlex Lam S.L <alexlamsl@gmail.com>2018-01-17 21:33:13 +0800
committerGitHub <noreply@github.com>2018-01-17 21:33:13 +0800
commit07e4b64f3a8439a9491cc7a277872e0a5d79a29b (patch)
tree6a2be087889003300ea1a17fcef7ce6ecf197c6b /lib/ast.js
parentd3ce2bc9e73d9d98b34b261d282a18b9ce9d5880 (diff)
downloadtracifyjs-07e4b64f3a8439a9491cc7a277872e0a5d79a29b.tar.gz
tracifyjs-07e4b64f3a8439a9491cc7a277872e0a5d79a29b.zip
fix `AST_Scope.clone()` (#2803)
fixes #2799
Diffstat (limited to 'lib/ast.js')
-rw-r--r--lib/ast.js7
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/ast.js b/lib/ast.js
index 4e41659c..19f6bfb5 100644
--- a/lib/ast.js
+++ b/lib/ast.js
@@ -308,6 +308,13 @@ var AST_Scope = DEFNODE("Scope", "variables functions uses_with uses_eval parent
enclosed: "[SymbolDef*/S] a list of all symbol definitions that are accessed from this scope or any subscopes",
cname: "[integer/S] current index for mangling variables (used internally by the mangler)",
},
+ clone: function(deep) {
+ var node = this._clone(deep);
+ if (this.variables) node.variables = this.variables.clone();
+ if (this.functions) node.functions = this.functions.clone();
+ if (this.enclosed) node.enclosed = this.enclosed.slice();
+ return node;
+ }
}, AST_Block);
var AST_Toplevel = DEFNODE("Toplevel", "globals", {