ast.js: add a property 'cloned_from' which referred to the origin ast instance to the cloned ast; otherwise we will lose connection between transformer.before and transformer.after
This commit is contained in:
parent
9916d0e547
commit
842212d5d0
|
|
@ -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", {
|
var AST_Node = DEFNODE("Node", "start end", {
|
||||||
clone: function() {
|
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",
|
$documentation: "Base class of all AST nodes",
|
||||||
$propdoc: {
|
$propdoc: {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user