flow parser plugin: move up startPos and startLoc default assignments

This commit is contained in:
Sebastian McKenzie 2015-07-15 20:33:56 +01:00
parent d661e15ce2
commit d2ce03e82d
2 changed files with 5 additions and 4 deletions

View File

@ -847,6 +847,9 @@ export default function (instance) {
instance.extend("parseParenAndDistinguishExpression", function (inner) {
return function (startPos, startLoc, canBeArrow, isAsync) {
startPos = startPos || this.start;
startLoc = startLoc || this.startLoc;
if (this.lookahead().type === tt.parenR) {
// var foo = (): number => {};
this.expect(tt.parenL);
@ -858,8 +861,6 @@ export default function (instance) {
return this.parseArrowExpression(node, [], isAsync);
} else {
// var foo = (foo): number => {};
startPos = startPos || this.start;
startLoc = startLoc || this.startLoc;
let node = inner.call(this, startPos, startLoc, canBeArrow, isAsync);
var state = this.getState();

View File

@ -5896,7 +5896,7 @@ var fbTestFixture = {
},
init: {
type: "ArrowFunctionExpression",
start: null,
start: 10,
end: 27,
returnType: {
type: "TypeAnnotation",
@ -6082,7 +6082,7 @@ var fbTestFixture = {
},
init: {
type: "ArrowFunctionExpression",
start: null,
start: 11,
end: 28,
returnType: {
type: "TypeAnnotation",