Ensure consistent start args for parseParenItem (#386)
This commit is contained in:
committed by
Daniel Tschinder
parent
9a5d93fa61
commit
cd133ff8e1
@@ -595,7 +595,7 @@ pp.parseParenAndDistinguishExpression = function (startPos, startLoc, canBeArrow
|
||||
const spreadNodeStartPos = this.state.start;
|
||||
const spreadNodeStartLoc = this.state.startLoc;
|
||||
spreadStart = this.state.start;
|
||||
exprList.push(this.parseParenItem(this.parseRest(), spreadNodeStartLoc, spreadNodeStartPos));
|
||||
exprList.push(this.parseParenItem(this.parseRest(), spreadNodeStartPos, spreadNodeStartLoc));
|
||||
break;
|
||||
} else {
|
||||
exprList.push(this.parseMaybeAssign(false, refShorthandDefaultPos, this.parseParenItem, refNeedsArrowPos));
|
||||
|
||||
@@ -940,14 +940,14 @@ export default function (instance) {
|
||||
});
|
||||
|
||||
instance.extend("parseParenItem", function (inner) {
|
||||
return function (node, startLoc, startPos) {
|
||||
node = inner.call(this, node, startLoc, startPos);
|
||||
return function (node, startPos, startLoc) {
|
||||
node = inner.call(this, node, startPos, startLoc);
|
||||
if (this.eat(tt.question)) {
|
||||
node.optional = true;
|
||||
}
|
||||
|
||||
if (this.match(tt.colon)) {
|
||||
const typeCastNode = this.startNodeAt(startLoc, startPos);
|
||||
const typeCastNode = this.startNodeAt(startPos, startLoc);
|
||||
typeCastNode.expression = node;
|
||||
typeCastNode.typeAnnotation = this.flowParseTypeAnnotation();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user