flow parser plugin: move up startPos and startLoc default assignments
This commit is contained in:
parent
d661e15ce2
commit
d2ce03e82d
@ -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();
|
||||
|
||||
@ -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",
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user