Ensure consistent start args for parseParenItem (#386)

This commit is contained in:
Brian Ng
2017-02-28 05:56:56 -06:00
committed by Daniel Tschinder
parent 9a5d93fa61
commit cd133ff8e1
4 changed files with 283 additions and 4 deletions

View File

@@ -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();