remove noop traversal visitors methods
This commit is contained in:
parent
2a5cb9d21b
commit
f657598c72
@ -745,11 +745,10 @@ export default class TraversalPath {
|
||||
if (!node) return;
|
||||
|
||||
var opts = this.opts;
|
||||
var fns = [].concat(opts[key]);
|
||||
if (!opts[key] && !opts[node.type]) return;
|
||||
|
||||
if (opts[node.type]) {
|
||||
fns = fns.concat(opts[node.type][key]);
|
||||
}
|
||||
var fns = [].concat(opts[key]);
|
||||
if (opts[node.type]) fns = fns.concat(opts[node.type][key]);
|
||||
|
||||
for (var fn of (fns: Array)) {
|
||||
if (!fn) continue;
|
||||
@ -789,7 +788,7 @@ export default class TraversalPath {
|
||||
|
||||
visit(): boolean {
|
||||
if (this.isBlacklisted()) return false;
|
||||
if (this.opts.shouldSkip(this)) return false;
|
||||
if (this.opts.shouldSkip && this.opts.shouldSkip(this)) return false;
|
||||
|
||||
this.call("enter");
|
||||
|
||||
|
||||
@ -82,10 +82,6 @@ export function verify(visitor) {
|
||||
throw new Error(messages.get("traverseVerifyRootFunction"));
|
||||
}
|
||||
|
||||
if (!visitor.enter) visitor.enter = function () { };
|
||||
if (!visitor.exit) visitor.exit = function () { };
|
||||
if (!visitor.shouldSkip) visitor.shouldSkip = function () { return false; };
|
||||
|
||||
for (var nodeType in visitor) {
|
||||
if (shouldIgnoreKey(nodeType)) continue;
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user