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) {
|
instance.extend("parseParenAndDistinguishExpression", function (inner) {
|
||||||
return function (startPos, startLoc, canBeArrow, isAsync) {
|
return function (startPos, startLoc, canBeArrow, isAsync) {
|
||||||
|
startPos = startPos || this.start;
|
||||||
|
startLoc = startLoc || this.startLoc;
|
||||||
|
|
||||||
if (this.lookahead().type === tt.parenR) {
|
if (this.lookahead().type === tt.parenR) {
|
||||||
// var foo = (): number => {};
|
// var foo = (): number => {};
|
||||||
this.expect(tt.parenL);
|
this.expect(tt.parenL);
|
||||||
@ -858,8 +861,6 @@ export default function (instance) {
|
|||||||
return this.parseArrowExpression(node, [], isAsync);
|
return this.parseArrowExpression(node, [], isAsync);
|
||||||
} else {
|
} else {
|
||||||
// var foo = (foo): number => {};
|
// var foo = (foo): number => {};
|
||||||
startPos = startPos || this.start;
|
|
||||||
startLoc = startLoc || this.startLoc;
|
|
||||||
let node = inner.call(this, startPos, startLoc, canBeArrow, isAsync);
|
let node = inner.call(this, startPos, startLoc, canBeArrow, isAsync);
|
||||||
|
|
||||||
var state = this.getState();
|
var state = this.getState();
|
||||||
|
|||||||
@ -5896,7 +5896,7 @@ var fbTestFixture = {
|
|||||||
},
|
},
|
||||||
init: {
|
init: {
|
||||||
type: "ArrowFunctionExpression",
|
type: "ArrowFunctionExpression",
|
||||||
start: null,
|
start: 10,
|
||||||
end: 27,
|
end: 27,
|
||||||
returnType: {
|
returnType: {
|
||||||
type: "TypeAnnotation",
|
type: "TypeAnnotation",
|
||||||
@ -6082,7 +6082,7 @@ var fbTestFixture = {
|
|||||||
},
|
},
|
||||||
init: {
|
init: {
|
||||||
type: "ArrowFunctionExpression",
|
type: "ArrowFunctionExpression",
|
||||||
start: null,
|
start: 11,
|
||||||
end: 28,
|
end: 28,
|
||||||
returnType: {
|
returnType: {
|
||||||
type: "TypeAnnotation",
|
type: "TypeAnnotation",
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user