From eb72ea3e5ade5b9e1bc27da929d60650ca0c802f Mon Sep 17 00:00:00 2001 From: Sebastian McKenzie Date: Sun, 7 Jun 2015 23:36:12 +0100 Subject: [PATCH] rename path verification methods to introspection and add NodePath#getSource method --- src/babel/traversal/path/README.md | 2 +- .../path/{verification.js => introspection.js} | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) rename src/babel/traversal/path/{verification.js => introspection.js} (96%) diff --git a/src/babel/traversal/path/README.md b/src/babel/traversal/path/README.md index 797576fd16..46b9037959 100644 --- a/src/babel/traversal/path/README.md +++ b/src/babel/traversal/path/README.md @@ -7,4 +7,4 @@ - `replacement` - Methods responsible for replacing a node with another. - `removal` - Methods responsible for removing a node. - `family` - Methods responsible for dealing with/retrieving children or siblings. - - `verification` - Methodsresponsible for introspecting the current path for certain values. + - `introspection` - Methods responsible for introspecting the current path for certain values. diff --git a/src/babel/traversal/path/verification.js b/src/babel/traversal/path/introspection.js similarity index 96% rename from src/babel/traversal/path/verification.js rename to src/babel/traversal/path/introspection.js index 38b5fde27f..bd72f259de 100644 --- a/src/babel/traversal/path/verification.js +++ b/src/babel/traversal/path/introspection.js @@ -210,3 +210,16 @@ export function referencesImport(moduleSource, importName) { return false; } + +/** + * Description + */ + +export function getSource() { + var node = this.node; + if (node.end) { + return this.hub.file.code.slice(node.start, node.end); + } else { + return ""; + } +}