Added custom NodePath.prototype.toString method as debug utility (#7218)
This commit is contained in:
parent
79c84f2f9b
commit
0a517b51cd
@ -7,6 +7,7 @@ import traverse from "../index";
|
|||||||
import Scope from "../scope";
|
import Scope from "../scope";
|
||||||
import * as t from "@babel/types";
|
import * as t from "@babel/types";
|
||||||
import { path as pathCache } from "../cache";
|
import { path as pathCache } from "../cache";
|
||||||
|
import generator from "@babel/generator";
|
||||||
|
|
||||||
// NodePath is split across many files.
|
// NodePath is split across many files.
|
||||||
import * as NodePath_ancestry from "./ancestry";
|
import * as NodePath_ancestry from "./ancestry";
|
||||||
@ -146,6 +147,10 @@ export default class NodePath {
|
|||||||
if (!debug.enabled) return;
|
if (!debug.enabled) return;
|
||||||
debug(`${this.getPathLocation()} ${this.type}: ${message}`);
|
debug(`${this.getPathLocation()} ${this.type}: ${message}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
toString() {
|
||||||
|
return generator(this.node).code;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Object.assign(
|
Object.assign(
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user