fix toggling of AST validation (#4499)

This commit is contained in:
Alex Lam S.L
2021-01-03 03:09:10 +00:00
committed by GitHub
parent e8c04f8cb6
commit 623a0d920f

View File

@@ -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);
};