validate against multiple parents on AST_Node (#4032)
- fix related issues in `global_defs`, `ie8` & `reduce_vars`
This commit is contained in:
@@ -120,6 +120,13 @@ var AST_Node = DEFNODE("Node", "start end", {
|
||||
ctor.prototype._validate.call(this);
|
||||
} while (ctor = ctor.BASE);
|
||||
},
|
||||
validate_ast: function() {
|
||||
var marker = {};
|
||||
this.walk(new TreeWalker(function(node) {
|
||||
if (node.validate_visited === marker) throw new Error("invalid node reuse: " + node);
|
||||
node.validate_visited = marker;
|
||||
}));
|
||||
},
|
||||
}, null);
|
||||
|
||||
(AST_Node.log_function = function(fn, verbose) {
|
||||
|
||||
Reference in New Issue
Block a user