aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Lam S.L <alexlamsl@gmail.com>2021-01-03 03:09:10 +0000
committerGitHub <noreply@github.com>2021-01-03 11:09:10 +0800
commit623a0d920f66656d7874a4bf005c24b44abb95a4 (patch)
tree2f8a295445917c664bfda99771ffb2c61e1ef89a
parente8c04f8cb691ee132c7d3b0b10db0d7da8ce3bf6 (diff)
downloadtracifyjs-623a0d920f66656d7874a4bf005c24b44abb95a4.tar.gz
tracifyjs-623a0d920f66656d7874a4bf005c24b44abb95a4.zip
fix toggling of AST validation (#4499)
-rw-r--r--lib/ast.js3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/ast.js b/lib/ast.js
index a7885a79..7b4c03d7 100644
--- a/lib/ast.js
+++ b/lib/ast.js
@@ -160,6 +160,8 @@ var restore_transforms = [];
AST_Node.enable_validation = function() {
AST_Node.disable_validation();
(function validate_transform(ctor) {
+ ctor.SUBCLASSES.forEach(validate_transform);
+ if (!HOP(ctor.prototype, "transform")) return;
var transform = ctor.prototype.transform;
ctor.prototype.transform = function(tw, in_list) {
var node = transform.call(this, tw, in_list);
@@ -173,7 +175,6 @@ AST_Node.enable_validation = function() {
restore_transforms.push(function() {
ctor.prototype.transform = transform;
});
- ctor.SUBCLASSES.forEach(validate_transform);
})(this);
};