}, null);
var AST_Node = DEFNODE("Node", "start end", {
- clone: function(deep) {
+ _clone: function(deep) {
if (deep) {
var self = this.clone();
return self.transform(new TreeTransformer(function(node) {
}
return new this.CTOR(this);
},
+ clone: function(deep) {
+ return this._clone(deep);
+ },
$documentation: "Base class of all AST nodes",
$propdoc: {
start: "[AST_Token] The first token of this node",
this.label._walk(visitor);
this.body._walk(visitor);
});
+ },
+ clone: function(deep) {
+ var node = this._clone(deep);
+ if (deep) {
+ var refs = node.label.references;
+ var label = this.label;
+ node.walk(new TreeWalker(function(node) {
+ if (node instanceof AST_LoopControl
+ && node.label && node.label.thedef === label) {
+ refs.push(node);
+ }
+ }));
+ }
+ return node;
}
}, AST_StatementWithBody);