Allow typeAnnotations for yield epressions (#174)

This commit is contained in:
Daniel Tschinder
2016-10-14 18:07:46 +02:00
committed by Henry Zhu
parent 44f77bd724
commit b31834ad29
3 changed files with 333 additions and 4 deletions

View File

@@ -89,8 +89,13 @@ pp.parseExpression = function (noIn, refShorthandDefaultPos) {
// operators like `+=`.
pp.parseMaybeAssign = function (noIn, refShorthandDefaultPos, afterLeftParse, refNeedsArrowPos) {
let startPos = this.state.start;
let startLoc = this.state.startLoc;
if (this.match(tt._yield) && this.state.inGenerator) {
return this.parseYield();
let left = this.parseYield();
if (afterLeftParse) left = afterLeftParse.call(this, left, startPos, startLoc);
return left;
}
let failOnShorthandAssign;
@@ -101,9 +106,6 @@ pp.parseMaybeAssign = function (noIn, refShorthandDefaultPos, afterLeftParse, re
failOnShorthandAssign = true;
}
let startPos = this.state.start;
let startLoc = this.state.startLoc;
if (this.match(tt.parenL) || this.match(tt.name)) {
this.state.potentialArrowAt = this.state.start;
}