diff --git a/lib/ast.js b/lib/ast.js index c0b263e7..03f90b69 100644 --- a/lib/ast.js +++ b/lib/ast.js @@ -89,7 +89,10 @@ var AST_Token = DEFNODE("Token", "type value line col pos endpos nlb comments_be var AST_Node = DEFNODE("Node", "start end", { clone: function() { - return new this.CTOR(this); + var cloned = new this.CTOR(this); + cloned.cloned_from = this; + + return cloned; }, $documentation: "Base class of all AST nodes", $propdoc: {