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 * as t from "@babel/types";
|
||||
import { path as pathCache } from "../cache";
|
||||
import generator from "@babel/generator";
|
||||
|
||||
// NodePath is split across many files.
|
||||
import * as NodePath_ancestry from "./ancestry";
|
||||
@ -146,6 +147,10 @@ export default class NodePath {
|
||||
if (!debug.enabled) return;
|
||||
debug(`${this.getPathLocation()} ${this.type}: ${message}`);
|
||||
}
|
||||
|
||||
toString() {
|
||||
return generator(this.node).code;
|
||||
}
|
||||
}
|
||||
|
||||
Object.assign(
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user