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