@babel/parser: include leading character into range of generic ArrowFunctionExpression (#9295)
This commit is contained in:
parent
03022d169e
commit
46e3f6df1f
@ -2001,10 +2001,7 @@ export default (superClass: Class<Parser>): Class<Parser> =>
|
|||||||
|
|
||||||
// Correct TypeScript code should have at least 1 type parameter, but don't crash on bad code.
|
// Correct TypeScript code should have at least 1 type parameter, but don't crash on bad code.
|
||||||
if (typeParameters && typeParameters.params.length !== 0) {
|
if (typeParameters && typeParameters.params.length !== 0) {
|
||||||
this.resetStartLocationFromNode(
|
this.resetStartLocationFromNode(arrowExpression, typeParameters);
|
||||||
arrowExpression,
|
|
||||||
typeParameters.params[0],
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
arrowExpression.typeParameters = typeParameters;
|
arrowExpression.typeParameters = typeParameters;
|
||||||
return arrowExpression;
|
return arrowExpression;
|
||||||
|
|||||||
@ -45,12 +45,12 @@
|
|||||||
},
|
},
|
||||||
"expression": {
|
"expression": {
|
||||||
"type": "ArrowFunctionExpression",
|
"type": "ArrowFunctionExpression",
|
||||||
"start": 62,
|
"start": 61,
|
||||||
"end": 78,
|
"end": 78,
|
||||||
"loc": {
|
"loc": {
|
||||||
"start": {
|
"start": {
|
||||||
"line": 2,
|
"line": 2,
|
||||||
"column": 1
|
"column": 0
|
||||||
},
|
},
|
||||||
"end": {
|
"end": {
|
||||||
"line": 2,
|
"line": 2,
|
||||||
|
|||||||
@ -45,12 +45,12 @@
|
|||||||
},
|
},
|
||||||
"expression": {
|
"expression": {
|
||||||
"type": "ArrowFunctionExpression",
|
"type": "ArrowFunctionExpression",
|
||||||
"start": 1,
|
"start": 0,
|
||||||
"end": 17,
|
"end": 17,
|
||||||
"loc": {
|
"loc": {
|
||||||
"start": {
|
"start": {
|
||||||
"line": 1,
|
"line": 1,
|
||||||
"column": 1
|
"column": 0
|
||||||
},
|
},
|
||||||
"end": {
|
"end": {
|
||||||
"line": 1,
|
"line": 1,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user