-
-
Notifications
You must be signed in to change notification settings - Fork 5.8k
Closed
Labels
area: commentsoutdatedA closed issue/PR that is archived due to age. Recommended to make a new issueA closed issue/PR that is archived due to age. Recommended to make a new issuepkg: parser
Description
Bug Report
Current Behavior
Given the current code block:
test(function() {
var a = 1;
// one
}
// two
);The first line of comment is incorrectly attributed to the trailingComments of the anonymous function:
{
"type": "File",
"program": {
"body": [
{
"type": "ExpressionStatement",
"expression": {
"type": "CallExpression",
"arguments": [
{
"type": "FunctionExpression",
"body": {
"type": "BlockStatement",
},
"trailingComments": [
{
"type": "CommentLine",
"value": " two",
"start": 34,
"end": 40,
"loc": {
"start": {
"line": 4,
"column": 2
},
"end": {
"line": 4,
"column": 8
}
}
},
{
"type": "CommentLine",
"value": " three",
"start": 46,
"end": 54,
"loc": {
"start": {
"line": 6,
"column": 1
},
"end": {
"line": 6,
"column": 9
}
}
}
]
Expected behavior/code
trailingComments for the anonymous function should only contain the second comment line.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
area: commentsoutdatedA closed issue/PR that is archived due to age. Recommended to make a new issueA closed issue/PR that is archived due to age. Recommended to make a new issuepkg: parser