Collect comments around parentheses in expressions (#13803)
Co-authored-by: Brian Ng <bng412@gmail.com>
This commit is contained in:
128
packages/babel-parser/test/fixtures/comments/basic/nested-parentheses/output.json
vendored
Normal file
128
packages/babel-parser/test/fixtures/comments/basic/nested-parentheses/output.json
vendored
Normal file
@@ -0,0 +1,128 @@
|
||||
{
|
||||
"type": "File",
|
||||
"start":0,"end":68,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":68}},
|
||||
"program": {
|
||||
"type": "Program",
|
||||
"start":0,"end":68,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":68}},
|
||||
"sourceType": "script",
|
||||
"interpreter": null,
|
||||
"body": [
|
||||
{
|
||||
"type": "ExpressionStatement",
|
||||
"start":0,"end":68,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":68}},
|
||||
"expression": {
|
||||
"type": "BinaryExpression",
|
||||
"start":0,"end":60,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":60}},
|
||||
"left": {
|
||||
"type": "NumericLiteral",
|
||||
"start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1}},
|
||||
"extra": {
|
||||
"rawValue": 1,
|
||||
"raw": "1"
|
||||
},
|
||||
"value": 1
|
||||
},
|
||||
"operator": "+",
|
||||
"right": {
|
||||
"type": "Identifier",
|
||||
"start":35,"end":36,"loc":{"start":{"line":1,"column":35},"end":{"line":1,"column":36},"identifierName":"i"},
|
||||
"name": "i",
|
||||
"extra": {
|
||||
"parenthesized": true,
|
||||
"parenStart": 11
|
||||
},
|
||||
"trailingComments": [
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 4 ",
|
||||
"start":36,"end":43,"loc":{"start":{"line":1,"column":36},"end":{"line":1,"column":43}}
|
||||
},
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 5 ",
|
||||
"start":44,"end":51,"loc":{"start":{"line":1,"column":44},"end":{"line":1,"column":51}}
|
||||
},
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 6 ",
|
||||
"start":52,"end":59,"loc":{"start":{"line":1,"column":52},"end":{"line":1,"column":59}}
|
||||
}
|
||||
],
|
||||
"leadingComments": [
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 0 ",
|
||||
"start":4,"end":11,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":11}}
|
||||
},
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 1 ",
|
||||
"start":12,"end":19,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":19}}
|
||||
},
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 2 ",
|
||||
"start":20,"end":27,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":27}}
|
||||
},
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 3 ",
|
||||
"start":28,"end":35,"loc":{"start":{"line":1,"column":28},"end":{"line":1,"column":35}}
|
||||
}
|
||||
]
|
||||
},
|
||||
"trailingComments": [
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 7 ",
|
||||
"start":60,"end":67,"loc":{"start":{"line":1,"column":60},"end":{"line":1,"column":67}}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
],
|
||||
"directives": []
|
||||
},
|
||||
"comments": [
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 0 ",
|
||||
"start":4,"end":11,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":11}}
|
||||
},
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 1 ",
|
||||
"start":12,"end":19,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":19}}
|
||||
},
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 2 ",
|
||||
"start":20,"end":27,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":27}}
|
||||
},
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 3 ",
|
||||
"start":28,"end":35,"loc":{"start":{"line":1,"column":28},"end":{"line":1,"column":35}}
|
||||
},
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 4 ",
|
||||
"start":36,"end":43,"loc":{"start":{"line":1,"column":36},"end":{"line":1,"column":43}}
|
||||
},
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 5 ",
|
||||
"start":44,"end":51,"loc":{"start":{"line":1,"column":44},"end":{"line":1,"column":51}}
|
||||
},
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 6 ",
|
||||
"start":52,"end":59,"loc":{"start":{"line":1,"column":52},"end":{"line":1,"column":59}}
|
||||
},
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 7 ",
|
||||
"start":60,"end":67,"loc":{"start":{"line":1,"column":60},"end":{"line":1,"column":67}}
|
||||
}
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user