Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[parser] Don't crash on comment after trailing comma after eli… (#10490)
- Loading branch information
1 parent
26be14b
commit 0e95026
Showing
3 changed files
with
200 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 2 additions & 0 deletions
2
packages/babel-parser/test/fixtures/comments/regression/10448/input.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
function foo([foo, /* not used */, /* not used */]) { | ||
} |
191 changes: 191 additions & 0 deletions
191
packages/babel-parser/test/fixtures/comments/regression/10448/output.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,191 @@ | ||
{ | ||
"type": "File", | ||
"start": 0, | ||
"end": 55, | ||
"loc": { | ||
"start": { | ||
"line": 1, | ||
"column": 0 | ||
}, | ||
"end": { | ||
"line": 2, | ||
"column": 1 | ||
} | ||
}, | ||
"program": { | ||
"type": "Program", | ||
"start": 0, | ||
"end": 55, | ||
"loc": { | ||
"start": { | ||
"line": 1, | ||
"column": 0 | ||
}, | ||
"end": { | ||
"line": 2, | ||
"column": 1 | ||
} | ||
}, | ||
"sourceType": "script", | ||
"interpreter": null, | ||
"body": [ | ||
{ | ||
"type": "FunctionDeclaration", | ||
"start": 0, | ||
"end": 55, | ||
"loc": { | ||
"start": { | ||
"line": 1, | ||
"column": 0 | ||
}, | ||
"end": { | ||
"line": 2, | ||
"column": 1 | ||
} | ||
}, | ||
"id": { | ||
"type": "Identifier", | ||
"start": 9, | ||
"end": 12, | ||
"loc": { | ||
"start": { | ||
"line": 1, | ||
"column": 9 | ||
}, | ||
"end": { | ||
"line": 1, | ||
"column": 12 | ||
}, | ||
"identifierName": "foo" | ||
}, | ||
"name": "foo" | ||
}, | ||
"generator": false, | ||
"async": false, | ||
"params": [ | ||
{ | ||
"type": "ArrayPattern", | ||
"start": 13, | ||
"end": 50, | ||
"loc": { | ||
"start": { | ||
"line": 1, | ||
"column": 13 | ||
}, | ||
"end": { | ||
"line": 1, | ||
"column": 50 | ||
} | ||
}, | ||
"elements": [ | ||
{ | ||
"type": "Identifier", | ||
"start": 14, | ||
"end": 17, | ||
"loc": { | ||
"start": { | ||
"line": 1, | ||
"column": 14 | ||
}, | ||
"end": { | ||
"line": 1, | ||
"column": 17 | ||
}, | ||
"identifierName": "foo" | ||
}, | ||
"name": "foo", | ||
"trailingComments": [ | ||
{ | ||
"type": "CommentBlock", | ||
"value": " not used ", | ||
"start": 19, | ||
"end": 33, | ||
"loc": { | ||
"start": { | ||
"line": 1, | ||
"column": 19 | ||
}, | ||
"end": { | ||
"line": 1, | ||
"column": 33 | ||
} | ||
} | ||
}, | ||
{ | ||
"type": "CommentBlock", | ||
"value": " not used ", | ||
"start": 35, | ||
"end": 49, | ||
"loc": { | ||
"start": { | ||
"line": 1, | ||
"column": 35 | ||
}, | ||
"end": { | ||
"line": 1, | ||
"column": 49 | ||
} | ||
} | ||
} | ||
] | ||
}, | ||
null | ||
] | ||
} | ||
], | ||
"body": { | ||
"type": "BlockStatement", | ||
"start": 52, | ||
"end": 55, | ||
"loc": { | ||
"start": { | ||
"line": 1, | ||
"column": 52 | ||
}, | ||
"end": { | ||
"line": 2, | ||
"column": 1 | ||
} | ||
}, | ||
"body": [], | ||
"directives": [] | ||
} | ||
} | ||
], | ||
"directives": [] | ||
}, | ||
"comments": [ | ||
{ | ||
"type": "CommentBlock", | ||
"value": " not used ", | ||
"start": 19, | ||
"end": 33, | ||
"loc": { | ||
"start": { | ||
"line": 1, | ||
"column": 19 | ||
}, | ||
"end": { | ||
"line": 1, | ||
"column": 33 | ||
} | ||
} | ||
}, | ||
{ | ||
"type": "CommentBlock", | ||
"value": " not used ", | ||
"start": 35, | ||
"end": 49, | ||
"loc": { | ||
"start": { | ||
"line": 1, | ||
"column": 35 | ||
}, | ||
"end": { | ||
"line": 1, | ||
"column": 49 | ||
} | ||
} | ||
} | ||
] | ||
} |