babel-traverse
Advanced tools
Comparing version 6.18.0 to 6.19.0
@@ -11,2 +11,4 @@ "use strict"; | ||
exports.clear = clear; | ||
exports.clearPath = clearPath; | ||
exports.clearScope = clearScope; | ||
@@ -19,4 +21,12 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
function clear() { | ||
clearPath(); | ||
clearScope(); | ||
} | ||
function clearPath() { | ||
exports.path = path = new _weakMap2.default(); | ||
} | ||
function clearScope() { | ||
exports.scope = scope = new _weakMap2.default(); | ||
} |
@@ -158,2 +158,5 @@ "use strict"; | ||
traverse.clearCache.clearPath = cache.clearPath; | ||
traverse.clearCache.clearScope = cache.clearScope; | ||
traverse.copyCache = function (source, destination) { | ||
@@ -160,0 +163,0 @@ if (cache.path.has(source)) { |
@@ -16,2 +16,4 @@ "use strict"; | ||
exports.getAncestry = getAncestry; | ||
exports.isAncestor = isAncestor; | ||
exports.isDescendant = isDescendant; | ||
exports.inType = inType; | ||
@@ -185,2 +187,12 @@ exports.inShadow = inShadow; | ||
function isAncestor(maybeDescendant) { | ||
return maybeDescendant.isDescendant(this); | ||
} | ||
function isDescendant(maybeAncestor) { | ||
return !!this.findParent(function (parent) { | ||
return parent === maybeAncestor; | ||
}); | ||
} | ||
function inType() { | ||
@@ -187,0 +199,0 @@ var path = this; |
@@ -77,8 +77,8 @@ "use strict"; | ||
NodePath.get = function get(_ref) { | ||
var hub = _ref.hub; | ||
var parentPath = _ref.parentPath; | ||
var parent = _ref.parent; | ||
var container = _ref.container; | ||
var listKey = _ref.listKey; | ||
var key = _ref.key; | ||
var hub = _ref.hub, | ||
parentPath = _ref.parentPath, | ||
parent = _ref.parent, | ||
container = _ref.container, | ||
listKey = _ref.listKey, | ||
key = _ref.key; | ||
@@ -85,0 +85,0 @@ if (!hub && parentPath) { |
@@ -15,4 +15,4 @@ "use strict"; | ||
checkPath: function checkPath(_ref, opts) { | ||
var node = _ref.node; | ||
var parent = _ref.parent; | ||
var node = _ref.node, | ||
parent = _ref.parent; | ||
@@ -34,4 +34,4 @@ if (!t.isIdentifier(node, opts) && !t.isJSXMemberExpression(parent, opts)) { | ||
checkPath: function checkPath(_ref2) { | ||
var node = _ref2.node; | ||
var parent = _ref2.parent; | ||
var node = _ref2.node, | ||
parent = _ref2.parent; | ||
@@ -45,4 +45,4 @@ return t.isMemberExpression(node) && t.isReferenced(node, parent); | ||
checkPath: function checkPath(_ref3) { | ||
var node = _ref3.node; | ||
var parent = _ref3.parent; | ||
var node = _ref3.node, | ||
parent = _ref3.parent; | ||
@@ -56,4 +56,4 @@ return t.isIdentifier(node) && t.isBinding(node, parent); | ||
checkPath: function checkPath(_ref4) { | ||
var node = _ref4.node; | ||
var parent = _ref4.parent; | ||
var node = _ref4.node, | ||
parent = _ref4.parent; | ||
@@ -60,0 +60,0 @@ if (t.isStatement(node)) { |
@@ -13,7 +13,7 @@ "use strict"; | ||
function Binding(_ref) { | ||
var existing = _ref.existing; | ||
var identifier = _ref.identifier; | ||
var scope = _ref.scope; | ||
var path = _ref.path; | ||
var kind = _ref.kind; | ||
var existing = _ref.existing, | ||
identifier = _ref.identifier, | ||
scope = _ref.scope, | ||
path = _ref.path, | ||
kind = _ref.kind; | ||
(0, _classCallCheck3.default)(this, Binding); | ||
@@ -20,0 +20,0 @@ |
@@ -136,4 +136,4 @@ "use strict"; | ||
exit: function exit(path) { | ||
var node = path.node; | ||
var scope = path.scope; | ||
var node = path.node, | ||
scope = path.scope; | ||
@@ -140,0 +140,0 @@ var declar = node.declaration; |
@@ -111,7 +111,7 @@ "use strict"; | ||
Renamer.prototype.rename = function rename(block) { | ||
var binding = this.binding; | ||
var oldName = this.oldName; | ||
var newName = this.newName; | ||
var scope = binding.scope; | ||
var path = binding.path; | ||
var binding = this.binding, | ||
oldName = this.oldName, | ||
newName = this.newName; | ||
var scope = binding.scope, | ||
path = binding.path; | ||
@@ -118,0 +118,0 @@ |
{ | ||
"name": "babel-traverse", | ||
"version": "6.18.0", | ||
"version": "6.19.0", | ||
"description": "The Babel Traverse module maintains the overall tree state, and is responsible for replacing, removing, and adding nodes", | ||
@@ -14,3 +14,3 @@ "author": "Sebastian McKenzie <sebmck@gmail.com>", | ||
"babel-runtime": "^6.9.0", | ||
"babel-types": "^6.18.0", | ||
"babel-types": "^6.19.0", | ||
"babylon": "^6.11.0", | ||
@@ -17,0 +17,0 @@ "debug": "^2.2.0", |
147327
4145
Updatedbabel-types@^6.19.0