babel-traverse
Advanced tools
Comparing version 6.20.0 to 6.21.0
@@ -8,2 +8,4 @@ "use strict"; | ||
function shareCommentsWithSiblings() { | ||
if (typeof this.key === "string") return; | ||
var node = this.node; | ||
@@ -10,0 +12,0 @@ if (!node) return; |
@@ -110,3 +110,3 @@ "use strict"; | ||
if (binding.path.getStatementParent().key > path.key) return; | ||
if (this.getAttachmentParentForPath(binding.path).key > path.key) return; | ||
} | ||
@@ -130,14 +130,20 @@ } | ||
} else { | ||
return this.getNextScopeStatementParent(); | ||
return this.getNextScopeAttachmentParent(); | ||
} | ||
} else if (scope.path.isProgram()) { | ||
return this.getNextScopeStatementParent(); | ||
return this.getNextScopeAttachmentParent(); | ||
} | ||
}; | ||
PathHoister.prototype.getNextScopeStatementParent = function getNextScopeStatementParent() { | ||
PathHoister.prototype.getNextScopeAttachmentParent = function getNextScopeAttachmentParent() { | ||
var scope = this.scopes.pop(); | ||
if (scope) return scope.path.getStatementParent(); | ||
if (scope) return this.getAttachmentParentForPath(scope.path); | ||
}; | ||
PathHoister.prototype.getAttachmentParentForPath = function getAttachmentParentForPath(path) { | ||
do { | ||
if (!path.parentPath || Array.isArray(path.container) && path.isStatement() || path.isVariableDeclarator() && path.parentPath.node.declarations.length > 1) return path; | ||
} while (path = path.parentPath); | ||
}; | ||
PathHoister.prototype.hasOwnParamBindings = function hasOwnParamBindings(scope) { | ||
@@ -168,4 +174,6 @@ for (var name in this.bindings) { | ||
var uid = attachTo.scope.generateUidIdentifier("ref"); | ||
attachTo.insertBefore([t.variableDeclaration("var", [t.variableDeclarator(uid, this.path.node)])]); | ||
var declarator = t.variableDeclarator(uid, this.path.node); | ||
attachTo.insertBefore([attachTo.isVariableDeclarator() ? declarator : t.variableDeclaration("var", [declarator])]); | ||
var parent = this.path.parentPath; | ||
@@ -172,0 +180,0 @@ if (parent.isJSXElement() && this.path.container === parent.node.children) { |
{ | ||
"name": "babel-traverse", | ||
"version": "6.20.0", | ||
"version": "6.21.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.20.0", | ||
"babel-types": "^6.20.0", | ||
"babel-types": "^6.21.0", | ||
"babylon": "^6.11.0", | ||
@@ -17,0 +17,0 @@ "debug": "^2.2.0", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
149613
4210
Updatedbabel-types@^6.21.0