diff --git a/src/babel/traversal/path/index.js b/src/babel/traversal/path/index.js index 6ac9cc1819..68735963d8 100644 --- a/src/babel/traversal/path/index.js +++ b/src/babel/traversal/path/index.js @@ -125,6 +125,22 @@ export default class TraversalPath { return false; } + /** + * Check whether this node was a part of the original AST. + */ + + isUser() { + return this.node && !!this.node.loc; + } + + /** + * Check whether this node was generated by us and not a part of the original AST. + */ + + isGenerated() { + return !this.isUser(); + } + /** * Description */