Remove debug closures (#6349)
God, can you imagine how many useless closures this was creating?
This commit is contained in:
parent
3746273eda
commit
0e432f0e0d
@ -5,7 +5,7 @@ import traverse from "../index";
|
|||||||
export function call(key): boolean {
|
export function call(key): boolean {
|
||||||
const opts = this.opts;
|
const opts = this.opts;
|
||||||
|
|
||||||
this.debug(() => key);
|
this.debug(key);
|
||||||
|
|
||||||
if (this.node) {
|
if (this.node) {
|
||||||
if (this._call(opts[key])) return true;
|
if (this._call(opts[key])) return true;
|
||||||
@ -60,11 +60,11 @@ export function visit(): boolean {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (this.call("enter") || this.shouldSkip) {
|
if (this.call("enter") || this.shouldSkip) {
|
||||||
this.debug(() => "Skip...");
|
this.debug("Skip...");
|
||||||
return this.shouldStop;
|
return this.shouldStop;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.debug(() => "Recursing into...");
|
this.debug("Recursing into...");
|
||||||
traverse.node(
|
traverse.node(
|
||||||
this.node,
|
this.node,
|
||||||
this.opts,
|
this.opts,
|
||||||
|
|||||||
@ -142,9 +142,9 @@ export default class NodePath {
|
|||||||
return parts.join(".");
|
return parts.join(".");
|
||||||
}
|
}
|
||||||
|
|
||||||
debug(buildMessage: Function) {
|
debug(message) {
|
||||||
if (!debug.enabled) return;
|
if (!debug.enabled) return;
|
||||||
debug(`${this.getPathLocation()} ${this.type}: ${buildMessage()}`);
|
debug(`${this.getPathLocation()} ${this.type}: ${message}`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -64,7 +64,7 @@ export function _containerInsert(from, nodes) {
|
|||||||
|
|
||||||
for (const path of paths) {
|
for (const path of paths) {
|
||||||
path.setScope();
|
path.setScope();
|
||||||
path.debug(() => "Inserted.");
|
path.debug("Inserted.");
|
||||||
|
|
||||||
for (const context of contexts) {
|
for (const context of contexts) {
|
||||||
context.maybeQueue(path, true);
|
context.maybeQueue(path, true);
|
||||||
|
|||||||
@ -195,7 +195,7 @@ export function _replaceWith(node) {
|
|||||||
t.validate(this.parent, this.key, node);
|
t.validate(this.parent, this.key, node);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.debug(() => `Replace with ${node && node.type}`);
|
this.debug(`Replace with ${node && node.type}`);
|
||||||
|
|
||||||
this.node = this.container[this.key] = node;
|
this.node = this.container[this.key] = node;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user