diff --git a/src/plugins/flow.js b/src/plugins/flow.js index f74de36944..e7124b63f6 100644 --- a/src/plugins/flow.js +++ b/src/plugins/flow.js @@ -1162,6 +1162,8 @@ export default function (instance) { arrowExpression = inner.apply(this, args); arrowExpression.typeParameters = typeParameters; + arrowExpression.start = typeParameters.start; + arrowExpression.loc.start = typeParameters.loc.start; } catch (err) { throw jsxError || err; } diff --git a/test/fixtures/flow/type-parameter-declaration/arrow_with_jsx/expected.json b/test/fixtures/flow/type-parameter-declaration/arrow_with_jsx/expected.json index c1220867e5..5040de57dc 100644 --- a/test/fixtures/flow/type-parameter-declaration/arrow_with_jsx/expected.json +++ b/test/fixtures/flow/type-parameter-declaration/arrow_with_jsx/expected.json @@ -44,12 +44,12 @@ }, "expression": { "type": "ArrowFunctionExpression", - "start": 3, + "start": 0, "end": 12, "loc": { "start": { "line": 1, - "column": 3 + "column": 0 }, "end": { "line": 1, @@ -132,12 +132,12 @@ }, "expression": { "type": "ArrowFunctionExpression", - "start": 17, + "start": 14, "end": 27, "loc": { "start": { "line": 2, - "column": 3 + "column": 0 }, "end": { "line": 2, @@ -237,12 +237,12 @@ }, "expression": { "type": "ArrowFunctionExpression", - "start": 32, + "start": 29, "end": 50, "loc": { "start": { "line": 3, - "column": 3 + "column": 0 }, "end": { "line": 3, @@ -372,12 +372,12 @@ }, "expression": { "type": "ArrowFunctionExpression", - "start": 55, + "start": 52, "end": 77, "loc": { "start": { "line": 4, - "column": 3 + "column": 0 }, "end": { "line": 4, @@ -527,4 +527,4 @@ ], "directives": [] } -} \ No newline at end of file +} diff --git a/test/fixtures/flow/type-parameter-declaration/arrow_without_jsx/expected.json b/test/fixtures/flow/type-parameter-declaration/arrow_without_jsx/expected.json index 712058fe08..5040de57dc 100644 --- a/test/fixtures/flow/type-parameter-declaration/arrow_without_jsx/expected.json +++ b/test/fixtures/flow/type-parameter-declaration/arrow_without_jsx/expected.json @@ -44,12 +44,12 @@ }, "expression": { "type": "ArrowFunctionExpression", - "start": 3, + "start": 0, "end": 12, "loc": { "start": { "line": 1, - "column": 3 + "column": 0 }, "end": { "line": 1, @@ -132,12 +132,12 @@ }, "expression": { "type": "ArrowFunctionExpression", - "start": 17, + "start": 14, "end": 27, "loc": { "start": { "line": 2, - "column": 3 + "column": 0 }, "end": { "line": 2, @@ -237,12 +237,12 @@ }, "expression": { "type": "ArrowFunctionExpression", - "start": 32, + "start": 29, "end": 50, "loc": { "start": { "line": 3, - "column": 3 + "column": 0 }, "end": { "line": 3, @@ -372,12 +372,12 @@ }, "expression": { "type": "ArrowFunctionExpression", - "start": 55, + "start": 52, "end": 77, "loc": { "start": { "line": 4, - "column": 3 + "column": 0 }, "end": { "line": 4,