babylon
Advanced tools
Comparing version 6.0.2 to 6.0.14
@@ -192,7 +192,14 @@ /* @flow */ | ||
node.operator = this.state.value; | ||
if (node.operator === "**" && left.type === "UnaryExpression" && left.extra && !left.extra.parenthesizedArgument) { | ||
this.raise(left.argument.start, "Illegal expression. Wrap left hand side or entire exponentiation in parentheses."); | ||
} | ||
var op = this.state.type; | ||
this.next(); | ||
var startPos = this.state.start, | ||
startLoc = this.state.startLoc; | ||
var startPos = this.state.start; | ||
var startLoc = this.state.startLoc; | ||
node.right = this.parseExprOp(this.parseMaybeUnary(), startPos, startLoc, op.rightAssociative ? prec - 1 : prec, noIn); | ||
this.finishNode(node, op === _tokenizerTypes.types.logicalOR || op === _tokenizerTypes.types.logicalAND ? "LogicalExpression" : "BinaryExpression"); | ||
@@ -209,9 +216,16 @@ return this.parseExprOp(node, leftStartPos, leftStartLoc, minPrec, noIn); | ||
if (this.state.type.prefix) { | ||
var node = this.startNode(), | ||
update = this.match(_tokenizerTypes.types.incDec); | ||
var node = this.startNode(); | ||
var update = this.match(_tokenizerTypes.types.incDec); | ||
node.operator = this.state.value; | ||
node.prefix = true; | ||
this.next(); | ||
var argType = this.state.type; | ||
this.addExtra(node, "parenthesizedArgument", argType === _tokenizerTypes.types.parenL); | ||
node.argument = this.parseMaybeUnary(); | ||
if (refShorthandDefaultPos && refShorthandDefaultPos.start) this.unexpected(refShorthandDefaultPos.start); | ||
if (refShorthandDefaultPos && refShorthandDefaultPos.start) { | ||
this.unexpected(refShorthandDefaultPos.start); | ||
} | ||
if (update) { | ||
@@ -222,2 +236,3 @@ this.checkLVal(node.argument); | ||
} | ||
return this.finishNode(node, update ? "UpdateExpression" : "UnaryExpression"); | ||
@@ -247,8 +262,14 @@ } | ||
startLoc = this.state.startLoc; | ||
var potentialArrowAt = this.state.potentialArrowAt; | ||
var expr = this.parseExprAtom(refShorthandDefaultPos); | ||
if (expr.type === "ArrowFunctionExpression" && expr.start === potentialArrowAt) { | ||
return expr; | ||
} | ||
if (refShorthandDefaultPos && refShorthandDefaultPos.start) { | ||
return expr; | ||
} else { | ||
return this.parseSubscripts(expr, startPos, startLoc); | ||
} | ||
return this.parseSubscripts(expr, startPos, startLoc); | ||
}; | ||
@@ -277,3 +298,3 @@ | ||
} else if (!noCalls && this.match(_tokenizerTypes.types.parenL)) { | ||
var possibleAsync = base.type === "Identifier" && base.name === "async" && !this.canInsertSemicolon(); | ||
var possibleAsync = this.state.potentialArrowAt === base.start && base.type === "Identifier" && base.name === "async" && !this.canInsertSemicolon(); | ||
this.next(); | ||
@@ -743,3 +764,3 @@ | ||
if (!prop.computed && prop.key.type === "Identifier" && (prop.key.name === "get" || prop.key.name === "set") && (!this.match(_tokenizerTypes.types.comma) && !this.match(_tokenizerTypes.types.braceR))) { | ||
if (!prop.computed && prop.key.type === "Identifier" && (prop.key.name === "get" || prop.key.name === "set") && !this.match(_tokenizerTypes.types.comma) && !this.match(_tokenizerTypes.types.braceR)) { | ||
if (isGenerator || isAsync || isPattern) this.unexpected(); | ||
@@ -986,2 +1007,5 @@ prop.kind = prop.key.name; | ||
pp.parseAwait = function (node) { | ||
if (!this.state.inAsync) { | ||
this.unexpected(); | ||
} | ||
if (this.isLineTerminator()) { | ||
@@ -988,0 +1012,0 @@ this.unexpected(); |
@@ -158,4 +158,4 @@ /* @flow */ | ||
// Identifier node, we switch to interpreting it as a label. | ||
var maybeName = this.state.value, | ||
expr = this.parseExpression(); | ||
var maybeName = this.state.value; | ||
var expr = this.parseExpression(); | ||
@@ -162,0 +162,0 @@ if (starttype === _tokenizerTypes.types.name && expr.type === "Identifier" && this.eat(_tokenizerTypes.types.colon)) { |
@@ -660,2 +660,3 @@ /* @flow */ | ||
return function (node, startLoc, startPos, forceArrow /*:: ?*/) { | ||
var canBeArrow = this.state.potentialArrowAt = startPos; | ||
if (this.match(_tokenizerTypes.types.colon)) { | ||
@@ -670,3 +671,3 @@ var typeCastNode = this.startNodeAt(startLoc, startPos); | ||
if (this.eat(_tokenizerTypes.types.arrow)) { | ||
if (canBeArrow && this.eat(_tokenizerTypes.types.arrow)) { | ||
// ((lol): number => {}); | ||
@@ -960,3 +961,3 @@ var func = this.parseArrowExpression(this.startNodeAt(startLoc, startPos), [node]); | ||
if (this.lookahead().type === _tokenizerTypes.types.parenR) { | ||
if (canBeArrow && this.lookahead().type === _tokenizerTypes.types.parenR) { | ||
// let foo = (): number => {}; | ||
@@ -963,0 +964,0 @@ this.expect(_tokenizerTypes.types.parenL); |
{ | ||
"name": "babylon", | ||
"version": "6.0.2", | ||
"version": "6.0.14", | ||
"description": "A JavaScript parser", | ||
@@ -8,6 +8,6 @@ "author": "Sebastian McKenzie <sebmck@gmail.com>", | ||
"license": "MIT", | ||
"repository": "babel/babel", | ||
"repository": "https://github.com/babel/babel/tree/master/packages/babylon", | ||
"main": "lib/index.js", | ||
"dependencies": { | ||
"babel-runtime": "^6.0.2" | ||
"babel-runtime": "^5.0.0" | ||
}, | ||
@@ -14,0 +14,0 @@ "bin": { |
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
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
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
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
196792
5002
+ Addedbabel-runtime@5.8.38(transitive)
+ Addedcore-js@1.2.7(transitive)
- Removedbabel-runtime@6.26.0(transitive)
- Removedcore-js@2.6.12(transitive)
- Removedregenerator-runtime@0.11.1(transitive)
Updatedbabel-runtime@^5.0.0