aboutsummaryrefslogtreecommitdiff
path: root/lib/ast.js
diff options
context:
space:
mode:
Diffstat (limited to 'lib/ast.js')
-rw-r--r--lib/ast.js10
1 files changed, 9 insertions, 1 deletions
diff --git a/lib/ast.js b/lib/ast.js
index 1f163304..a2125e70 100644
--- a/lib/ast.js
+++ b/lib/ast.js
@@ -91,7 +91,15 @@ var AST_Token = DEFNODE("Token", "type value line col pos endline endcol endpos
}, null);
var AST_Node = DEFNODE("Node", "start end", {
- clone: function() {
+ clone: function(deep) {
+ if (deep) {
+ var self = this.clone();
+ return self.transform(new TreeTransformer(function(node) {
+ if (node !== self) {
+ return node.clone(true);
+ }
+ }));
+ }
return new this.CTOR(this);
},
$documentation: "Base class of all AST nodes",