Remove debug closures (#6349)

God, can you imagine how many useless closures this was creating?
This commit is contained in:
Justin Ridgewell 2017-09-29 21:31:43 -04:00 committed by GitHub
parent 3746273eda
commit 0e432f0e0d
4 changed files with 7 additions and 7 deletions

View File

@ -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,

View File

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

View File

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

View File

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