diff options
author | Alex Lam S.L <alexlamsl@gmail.com> | 2020-07-31 01:09:19 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-07-31 08:09:19 +0800 |
commit | 88423f2574bfd4f158caab1c08a5a5bf1718cab4 (patch) | |
tree | 57bf9646a755320b038d1cd0799758ff2c0741dd /lib/ast.js | |
parent | ee632a5519078ac3fe97d0864731bea4bdad9365 (diff) | |
download | tracifyjs-88423f2574bfd4f158caab1c08a5a5bf1718cab4.tar.gz tracifyjs-88423f2574bfd4f158caab1c08a5a5bf1718cab4.zip |
validate against multiple parents on `AST_Node` (#4032)
- fix related issues in `global_defs`, `ie8` & `reduce_vars`
Diffstat (limited to 'lib/ast.js')
-rw-r--r-- | lib/ast.js | 7 |
1 files changed, 7 insertions, 0 deletions
@@ -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) { |