validate against multiple parents on AST_Node (#4032)

- fix related issues in `global_defs`, `ie8` & `reduce_vars`
This commit is contained in:
Alex Lam S.L
2020-07-31 01:09:19 +01:00
committed by GitHub
parent ee632a5519
commit 88423f2574
7 changed files with 63 additions and 11 deletions

View File

@@ -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) {