diff --git a/lib/ast.js b/lib/ast.js index f3df78fe..953d031a 100644 --- a/lib/ast.js +++ b/lib/ast.js @@ -92,7 +92,10 @@ var AST_Token = DEFNODE("Token", "type value line col pos endline endcol endpos 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: {