babel-traverse
Advanced tools
Comparing version 6.16.0 to 6.18.0
@@ -249,3 +249,3 @@ "use strict"; | ||
function requeue() { | ||
var pathToQueue = arguments.length <= 0 || arguments[0] === undefined ? this : arguments[0]; | ||
var pathToQueue = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this; | ||
@@ -252,0 +252,0 @@ if (pathToQueue.removed) return; |
@@ -233,4 +233,46 @@ "use strict"; | ||
if (path.isObjectExpression()) {} | ||
if (path.isObjectExpression()) { | ||
var obj = {}; | ||
var props = path.get("properties"); | ||
for (var _iterator3 = props, _isArray3 = Array.isArray(_iterator3), _i3 = 0, _iterator3 = _isArray3 ? _iterator3 : (0, _getIterator3.default)(_iterator3);;) { | ||
var _ref3; | ||
if (_isArray3) { | ||
if (_i3 >= _iterator3.length) break; | ||
_ref3 = _iterator3[_i3++]; | ||
} else { | ||
_i3 = _iterator3.next(); | ||
if (_i3.done) break; | ||
_ref3 = _i3.value; | ||
} | ||
var prop = _ref3; | ||
if (prop.isObjectMethod() || prop.isSpreadProperty()) { | ||
return deopt(prop); | ||
} | ||
var keyPath = prop.get("key"); | ||
var key = keyPath; | ||
if (prop.node.computed) { | ||
key = key.evaluate(); | ||
if (!key.confident) { | ||
return deopt(keyPath); | ||
} | ||
key = key.value; | ||
} else if (key.isIdentifier()) { | ||
key = key.node.name; | ||
} else { | ||
key = key.node.value; | ||
} | ||
var valuePath = prop.get("value"); | ||
var _value2 = valuePath.evaluate(); | ||
if (!_value2.confident) { | ||
return deopt(valuePath); | ||
} | ||
_value2 = _value2.value; | ||
obj[key] = _value2; | ||
} | ||
return obj; | ||
} | ||
if (path.isLogicalExpression()) { | ||
@@ -237,0 +279,0 @@ var wasConfident = confident; |
@@ -138,3 +138,3 @@ "use strict"; | ||
NodePath.prototype.buildCodeFrameError = function buildCodeFrameError(msg) { | ||
var Error = arguments.length <= 1 || arguments[1] === undefined ? SyntaxError : arguments[1]; | ||
var Error = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : SyntaxError; | ||
@@ -141,0 +141,0 @@ return this.hub.file.buildCodeFrameError(this.node, msg, Error); |
@@ -88,2 +88,4 @@ "use strict"; | ||
return t.isMixedTypeAnnotation(type); | ||
} else if (baseName === "empty") { | ||
return t.isEmptyTypeAnnotation(type); | ||
} else if (baseName === "void") { | ||
@@ -90,0 +92,0 @@ return t.isVoidTypeAnnotation(type); |
"use strict"; | ||
exports.__esModule = true; | ||
exports.Class = exports.Function = exports.Identifier = undefined; | ||
exports.ClassDeclaration = exports.ClassExpression = exports.FunctionDeclaration = exports.ArrowFunctionExpression = exports.FunctionExpression = exports.Identifier = undefined; | ||
@@ -166,4 +166,7 @@ var _infererReference = require("./inferer-reference"); | ||
exports.Function = Func; | ||
exports.Class = Func; | ||
exports.FunctionExpression = Func; | ||
exports.ArrowFunctionExpression = Func; | ||
exports.FunctionDeclaration = Func; | ||
exports.ClassExpression = Func; | ||
exports.ClassDeclaration = Func; | ||
function CallExpression() { | ||
@@ -170,0 +173,0 @@ return resolveCall(this.get("callee")); |
@@ -18,3 +18,3 @@ "use strict"; | ||
if (!t.isIdentifier(node, opts)) { | ||
if (!t.isIdentifier(node, opts) && !t.isJSXMemberExpression(parent, opts)) { | ||
if (t.isJSXIdentifier(node, opts)) { | ||
@@ -21,0 +21,0 @@ if (_babelTypes.react.isCompatTag(node.name)) return false; |
@@ -260,3 +260,3 @@ "use strict"; | ||
function hoist() { | ||
var scope = arguments.length <= 0 || arguments[0] === undefined ? this.scope : arguments[0]; | ||
var scope = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.scope; | ||
@@ -263,0 +263,0 @@ var hoister = new _hoister2.default(this, scope); |
@@ -13,2 +13,6 @@ "use strict"; | ||
var _map = require("babel-runtime/core-js/map"); | ||
var _map2 = _interopRequireDefault(_map); | ||
var _classCallCheck2 = require("babel-runtime/helpers/classCallCheck"); | ||
@@ -238,2 +242,4 @@ | ||
this.path = path; | ||
this.labels = new _map2.default(); | ||
} | ||
@@ -246,3 +252,3 @@ | ||
Scope.prototype.generateDeclaredUidIdentifier = function generateDeclaredUidIdentifier() { | ||
var name = arguments.length <= 0 || arguments[0] === undefined ? "temp" : arguments[0]; | ||
var name = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "temp"; | ||
@@ -255,3 +261,3 @@ var id = this.generateUidIdentifier(name); | ||
Scope.prototype.generateUidIdentifier = function generateUidIdentifier() { | ||
var name = arguments.length <= 0 || arguments[0] === undefined ? "temp" : arguments[0]; | ||
var name = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "temp"; | ||
@@ -262,3 +268,3 @@ return t.identifier(this.generateUid(name)); | ||
Scope.prototype.generateUid = function generateUid() { | ||
var name = arguments.length <= 0 || arguments[0] === undefined ? "temp" : arguments[0]; | ||
var name = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "temp"; | ||
@@ -272,3 +278,3 @@ name = t.toIdentifier(name).replace(/^_+/, "").replace(/[0-9]+$/g, ""); | ||
i++; | ||
} while (this.hasBinding(uid) || this.hasGlobal(uid) || this.hasReference(uid)); | ||
} while (this.hasLabel(uid) || this.hasBinding(uid) || this.hasGlobal(uid) || this.hasReference(uid)); | ||
@@ -468,5 +474,17 @@ var program = this.getProgramParent(); | ||
Scope.prototype.hasLabel = function hasLabel(name) { | ||
return !!this.getLabel(name); | ||
}; | ||
Scope.prototype.getLabel = function getLabel(name) { | ||
return this.labels.get(name); | ||
}; | ||
Scope.prototype.registerLabel = function registerLabel(path) { | ||
this.labels.set(path.node.label.name, path); | ||
}; | ||
Scope.prototype.registerDeclaration = function registerDeclaration(path) { | ||
if (path.isLabeledStatement()) { | ||
this.registerBinding("label", path); | ||
this.registerLabel(path); | ||
} else if (path.isFunctionDeclaration()) { | ||
@@ -539,3 +557,3 @@ this.registerBinding("hoisted", path.get("id"), path); | ||
Scope.prototype.registerBinding = function registerBinding(kind, path) { | ||
var bindingPath = arguments.length <= 2 || arguments[2] === undefined ? path : arguments[2]; | ||
var bindingPath = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : path; | ||
@@ -542,0 +560,0 @@ if (!kind) throw new ReferenceError("no `kind`"); |
@@ -237,3 +237,3 @@ "use strict"; | ||
function merge(visitors) { | ||
var states = arguments.length <= 1 || arguments[1] === undefined ? [] : arguments[1]; | ||
var states = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : []; | ||
var wrapper = arguments[2]; | ||
@@ -240,0 +240,0 @@ |
{ | ||
"name": "babel-traverse", | ||
"version": "6.16.0", | ||
"description": "", | ||
"version": "6.18.0", | ||
"description": "The Babel Traverse module maintains the overall tree state, and is responsible for replacing, removing, and adding nodes", | ||
"author": "Sebastian McKenzie <sebmck@gmail.com>", | ||
@@ -14,6 +14,6 @@ "homepage": "https://babeljs.io/", | ||
"babel-runtime": "^6.9.0", | ||
"babel-types": "^6.16.0", | ||
"babel-types": "^6.18.0", | ||
"babylon": "^6.11.0", | ||
"debug": "^2.2.0", | ||
"globals": "^8.3.0", | ||
"globals": "^9.0.0", | ||
"invariant": "^2.2.0", | ||
@@ -20,0 +20,0 @@ "lodash": "^4.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
146789
4125
+ Addedglobals@9.18.0(transitive)
- Removedglobals@8.18.0(transitive)
Updatedbabel-types@^6.18.0
Updatedglobals@^9.0.0