Overhaul comment attachment (#13521)
* refactor: inline pushComment * chore: add benchmark cases * perf: overhaul comment attachment * cleanup * update test fixtures They are all bugfixes. * fix: merge HTMLComment parsing to skipSpace * perf: remove unattachedCommentStack baseline 128 nested leading comments: 11_034 ops/sec ±50.64% (0.091ms) baseline 256 nested leading comments: 6_037 ops/sec ±11.46% (0.166ms) baseline 512 nested leading comments: 3_077 ops/sec ±2.31% (0.325ms) baseline 1024 nested leading comments: 1_374 ops/sec ±3.22% (0.728ms) current 128 nested leading comments: 11_027 ops/sec ±37.41% (0.091ms) current 256 nested leading comments: 6_736 ops/sec ±1.39% (0.148ms) current 512 nested leading comments: 3_306 ops/sec ±0.69% (0.302ms) current 1024 nested leading comments: 1_579 ops/sec ±2.09% (0.633ms) baseline 128 nested trailing comments: 10_073 ops/sec ±42.95% (0.099ms) baseline 256 nested trailing comments: 6_294 ops/sec ±2.19% (0.159ms) baseline 512 nested trailing comments: 3_041 ops/sec ±0.8% (0.329ms) baseline 1024 nested trailing comments: 1_530 ops/sec ±1.18% (0.654ms) current 128 nested trailing comments: 11_461 ops/sec ±44.89% (0.087ms) current 256 nested trailing comments: 7_212 ops/sec ±1.6% (0.139ms) current 512 nested trailing comments: 3_403 ops/sec ±1% (0.294ms) current 1024 nested trailing comments: 1_539 ops/sec ±1.49% (0.65ms) * fix: do not expose CommentWhitespace type * add comments on CommentWhitespace * add test case for #11576 * fix: mark containerNode be the innermost node containing commentWS * fix: adjust trailing comma comments for Record/Tuple/OptionalCall * fix: drain comment stacks in parseExpression * docs: update comments * add a new benchmark * chore: containerNode => containingNode * add more benchmark cases * fix: avoid finishNodeAt in stmtToDirective * finalize comment right after containerNode is set * add testcase about directive * fix: finish SequenceExpression at current pos and adjust later * chore: rename test cases * add new test case on switch statement * fix: adjust comments after trailing comma of function params * add comment attachment design doc * misc fix * fix: reset previous trailing comments when parsing async method/accessor * chore: add more comment testcases * fix flow errors * fix: handle comments when parsing async arrow * fix: handle comments when "static" is a class modifier * fix flow errors * fix: handle comments when parsing async function/do * refactor: simplify resetPreviousNodeTrailingComments * update test fixtures
This commit is contained in:
3
packages/babel-parser/test/fixtures/comments/basic/arrow-function/input.js
vendored
Normal file
3
packages/babel-parser/test/fixtures/comments/basic/arrow-function/input.js
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
(/*1*/)=>x;
|
||||
|
||||
(/*1*/x/*2*/,/*3*/) /*4*/ => /*5*/ {}
|
||||
126
packages/babel-parser/test/fixtures/comments/basic/arrow-function/output.json
vendored
Normal file
126
packages/babel-parser/test/fixtures/comments/basic/arrow-function/output.json
vendored
Normal file
@@ -0,0 +1,126 @@
|
||||
{
|
||||
"type": "File",
|
||||
"start":0,"end":50,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":37}},
|
||||
"program": {
|
||||
"type": "Program",
|
||||
"start":0,"end":50,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":37}},
|
||||
"sourceType": "script",
|
||||
"interpreter": null,
|
||||
"body": [
|
||||
{
|
||||
"type": "ExpressionStatement",
|
||||
"start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}},
|
||||
"expression": {
|
||||
"type": "ArrowFunctionExpression",
|
||||
"start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}},
|
||||
"innerComments": [
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": "1",
|
||||
"start":1,"end":6,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":6}}
|
||||
}
|
||||
],
|
||||
"id": null,
|
||||
"generator": false,
|
||||
"async": false,
|
||||
"params": [],
|
||||
"body": {
|
||||
"type": "Identifier",
|
||||
"start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10},"identifierName":"x"},
|
||||
"name": "x"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "ExpressionStatement",
|
||||
"start":13,"end":50,"loc":{"start":{"line":3,"column":0},"end":{"line":3,"column":37}},
|
||||
"expression": {
|
||||
"type": "ArrowFunctionExpression",
|
||||
"start":13,"end":50,"loc":{"start":{"line":3,"column":0},"end":{"line":3,"column":37}},
|
||||
"innerComments": [
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": "4",
|
||||
"start":33,"end":38,"loc":{"start":{"line":3,"column":20},"end":{"line":3,"column":25}}
|
||||
}
|
||||
],
|
||||
"id": null,
|
||||
"generator": false,
|
||||
"async": false,
|
||||
"params": [
|
||||
{
|
||||
"type": "Identifier",
|
||||
"start":19,"end":20,"loc":{"start":{"line":3,"column":6},"end":{"line":3,"column":7},"identifierName":"x"},
|
||||
"leadingComments": [
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": "1",
|
||||
"start":14,"end":19,"loc":{"start":{"line":3,"column":1},"end":{"line":3,"column":6}}
|
||||
}
|
||||
],
|
||||
"trailingComments": [
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": "2",
|
||||
"start":20,"end":25,"loc":{"start":{"line":3,"column":7},"end":{"line":3,"column":12}}
|
||||
},
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": "3",
|
||||
"start":26,"end":31,"loc":{"start":{"line":3,"column":13},"end":{"line":3,"column":18}}
|
||||
}
|
||||
],
|
||||
"name": "x"
|
||||
}
|
||||
],
|
||||
"body": {
|
||||
"type": "BlockStatement",
|
||||
"start":48,"end":50,"loc":{"start":{"line":3,"column":35},"end":{"line":3,"column":37}},
|
||||
"leadingComments": [
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": "5",
|
||||
"start":42,"end":47,"loc":{"start":{"line":3,"column":29},"end":{"line":3,"column":34}}
|
||||
}
|
||||
],
|
||||
"body": [],
|
||||
"directives": []
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"directives": []
|
||||
},
|
||||
"comments": [
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": "1",
|
||||
"start":1,"end":6,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":6}}
|
||||
},
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": "1",
|
||||
"start":14,"end":19,"loc":{"start":{"line":3,"column":1},"end":{"line":3,"column":6}}
|
||||
},
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": "2",
|
||||
"start":20,"end":25,"loc":{"start":{"line":3,"column":7},"end":{"line":3,"column":12}}
|
||||
},
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": "3",
|
||||
"start":26,"end":31,"loc":{"start":{"line":3,"column":13},"end":{"line":3,"column":18}}
|
||||
},
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": "4",
|
||||
"start":33,"end":38,"loc":{"start":{"line":3,"column":20},"end":{"line":3,"column":25}}
|
||||
},
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": "5",
|
||||
"start":42,"end":47,"loc":{"start":{"line":3,"column":29},"end":{"line":3,"column":34}}
|
||||
}
|
||||
]
|
||||
}
|
||||
3
packages/babel-parser/test/fixtures/comments/basic/async-arrow-function/input.js
vendored
Normal file
3
packages/babel-parser/test/fixtures/comments/basic/async-arrow-function/input.js
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
/* 1 */ async /* 2 */ (/* 3 */) /* 4 */=>x;
|
||||
|
||||
/* 1 */ async /* 2 */ (/* 3 */x/* 4 */) /* 5 */ => /* 6 */ {}
|
||||
177
packages/babel-parser/test/fixtures/comments/basic/async-arrow-function/output.json
vendored
Normal file
177
packages/babel-parser/test/fixtures/comments/basic/async-arrow-function/output.json
vendored
Normal file
@@ -0,0 +1,177 @@
|
||||
{
|
||||
"type": "File",
|
||||
"start":0,"end":106,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":61}},
|
||||
"program": {
|
||||
"type": "Program",
|
||||
"start":0,"end":106,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":61}},
|
||||
"sourceType": "script",
|
||||
"interpreter": null,
|
||||
"body": [
|
||||
{
|
||||
"type": "ExpressionStatement",
|
||||
"start":8,"end":43,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":43}},
|
||||
"leadingComments": [
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 1 ",
|
||||
"start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}
|
||||
}
|
||||
],
|
||||
"trailingComments": [
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 1 ",
|
||||
"start":45,"end":52,"loc":{"start":{"line":3,"column":0},"end":{"line":3,"column":7}}
|
||||
}
|
||||
],
|
||||
"expression": {
|
||||
"type": "ArrowFunctionExpression",
|
||||
"start":8,"end":42,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":42}},
|
||||
"innerComments": [
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 2 ",
|
||||
"start":14,"end":21,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":21}}
|
||||
},
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 3 ",
|
||||
"start":23,"end":30,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":30}}
|
||||
},
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 4 ",
|
||||
"start":32,"end":39,"loc":{"start":{"line":1,"column":32},"end":{"line":1,"column":39}}
|
||||
}
|
||||
],
|
||||
"id": null,
|
||||
"generator": false,
|
||||
"async": true,
|
||||
"params": [],
|
||||
"body": {
|
||||
"type": "Identifier",
|
||||
"start":41,"end":42,"loc":{"start":{"line":1,"column":41},"end":{"line":1,"column":42},"identifierName":"x"},
|
||||
"name": "x"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "ExpressionStatement",
|
||||
"start":53,"end":106,"loc":{"start":{"line":3,"column":8},"end":{"line":3,"column":61}},
|
||||
"leadingComments": [
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 1 ",
|
||||
"start":45,"end":52,"loc":{"start":{"line":3,"column":0},"end":{"line":3,"column":7}}
|
||||
}
|
||||
],
|
||||
"expression": {
|
||||
"type": "ArrowFunctionExpression",
|
||||
"start":53,"end":106,"loc":{"start":{"line":3,"column":8},"end":{"line":3,"column":61}},
|
||||
"innerComments": [
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 2 ",
|
||||
"start":59,"end":66,"loc":{"start":{"line":3,"column":14},"end":{"line":3,"column":21}}
|
||||
},
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 5 ",
|
||||
"start":85,"end":92,"loc":{"start":{"line":3,"column":40},"end":{"line":3,"column":47}}
|
||||
}
|
||||
],
|
||||
"id": null,
|
||||
"generator": false,
|
||||
"async": true,
|
||||
"params": [
|
||||
{
|
||||
"type": "Identifier",
|
||||
"start":75,"end":76,"loc":{"start":{"line":3,"column":30},"end":{"line":3,"column":31},"identifierName":"x"},
|
||||
"leadingComments": [
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 3 ",
|
||||
"start":68,"end":75,"loc":{"start":{"line":3,"column":23},"end":{"line":3,"column":30}}
|
||||
}
|
||||
],
|
||||
"trailingComments": [
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 4 ",
|
||||
"start":76,"end":83,"loc":{"start":{"line":3,"column":31},"end":{"line":3,"column":38}}
|
||||
}
|
||||
],
|
||||
"name": "x"
|
||||
}
|
||||
],
|
||||
"body": {
|
||||
"type": "BlockStatement",
|
||||
"start":104,"end":106,"loc":{"start":{"line":3,"column":59},"end":{"line":3,"column":61}},
|
||||
"leadingComments": [
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 6 ",
|
||||
"start":96,"end":103,"loc":{"start":{"line":3,"column":51},"end":{"line":3,"column":58}}
|
||||
}
|
||||
],
|
||||
"body": [],
|
||||
"directives": []
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"directives": []
|
||||
},
|
||||
"comments": [
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 1 ",
|
||||
"start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}
|
||||
},
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 2 ",
|
||||
"start":14,"end":21,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":21}}
|
||||
},
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 3 ",
|
||||
"start":23,"end":30,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":30}}
|
||||
},
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 4 ",
|
||||
"start":32,"end":39,"loc":{"start":{"line":1,"column":32},"end":{"line":1,"column":39}}
|
||||
},
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 1 ",
|
||||
"start":45,"end":52,"loc":{"start":{"line":3,"column":0},"end":{"line":3,"column":7}}
|
||||
},
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 2 ",
|
||||
"start":59,"end":66,"loc":{"start":{"line":3,"column":14},"end":{"line":3,"column":21}}
|
||||
},
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 3 ",
|
||||
"start":68,"end":75,"loc":{"start":{"line":3,"column":23},"end":{"line":3,"column":30}}
|
||||
},
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 4 ",
|
||||
"start":76,"end":83,"loc":{"start":{"line":3,"column":31},"end":{"line":3,"column":38}}
|
||||
},
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 5 ",
|
||||
"start":85,"end":92,"loc":{"start":{"line":3,"column":40},"end":{"line":3,"column":47}}
|
||||
},
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 6 ",
|
||||
"start":96,"end":103,"loc":{"start":{"line":3,"column":51},"end":{"line":3,"column":58}}
|
||||
}
|
||||
]
|
||||
}
|
||||
1
packages/babel-parser/test/fixtures/comments/basic/async-call-expression/input.js
vendored
Normal file
1
packages/babel-parser/test/fixtures/comments/basic/async-call-expression/input.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
async /* 1 */ (/* 2 */) /* 3 */
|
||||
65
packages/babel-parser/test/fixtures/comments/basic/async-call-expression/output.json
vendored
Normal file
65
packages/babel-parser/test/fixtures/comments/basic/async-call-expression/output.json
vendored
Normal file
@@ -0,0 +1,65 @@
|
||||
{
|
||||
"type": "File",
|
||||
"start":0,"end":31,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":31}},
|
||||
"program": {
|
||||
"type": "Program",
|
||||
"start":0,"end":31,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":31}},
|
||||
"sourceType": "script",
|
||||
"interpreter": null,
|
||||
"body": [
|
||||
{
|
||||
"type": "ExpressionStatement",
|
||||
"start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}},
|
||||
"trailingComments": [
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 3 ",
|
||||
"start":24,"end":31,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":31}}
|
||||
}
|
||||
],
|
||||
"expression": {
|
||||
"type": "CallExpression",
|
||||
"start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}},
|
||||
"innerComments": [
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 2 ",
|
||||
"start":15,"end":22,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":22}}
|
||||
}
|
||||
],
|
||||
"callee": {
|
||||
"type": "Identifier",
|
||||
"start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5},"identifierName":"async"},
|
||||
"trailingComments": [
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 1 ",
|
||||
"start":6,"end":13,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":13}}
|
||||
}
|
||||
],
|
||||
"name": "async"
|
||||
},
|
||||
"arguments": []
|
||||
}
|
||||
}
|
||||
],
|
||||
"directives": []
|
||||
},
|
||||
"comments": [
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 1 ",
|
||||
"start":6,"end":13,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":13}}
|
||||
},
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 2 ",
|
||||
"start":15,"end":22,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":22}}
|
||||
},
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 3 ",
|
||||
"start":24,"end":31,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":31}}
|
||||
}
|
||||
]
|
||||
}
|
||||
1
packages/babel-parser/test/fixtures/comments/basic/async-do-expression/input.js
vendored
Normal file
1
packages/babel-parser/test/fixtures/comments/basic/async-do-expression/input.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
/* 1 */async/* 2 */do/* 3 */{/* 4 */}/* 5 */
|
||||
3
packages/babel-parser/test/fixtures/comments/basic/async-do-expression/options.json
vendored
Normal file
3
packages/babel-parser/test/fixtures/comments/basic/async-do-expression/options.json
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"plugins": ["asyncDoExpressions", "doExpressions"]
|
||||
}
|
||||
90
packages/babel-parser/test/fixtures/comments/basic/async-do-expression/output.json
vendored
Normal file
90
packages/babel-parser/test/fixtures/comments/basic/async-do-expression/output.json
vendored
Normal file
@@ -0,0 +1,90 @@
|
||||
{
|
||||
"type": "File",
|
||||
"start":0,"end":44,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":44}},
|
||||
"program": {
|
||||
"type": "Program",
|
||||
"start":0,"end":44,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":44}},
|
||||
"sourceType": "script",
|
||||
"interpreter": null,
|
||||
"body": [
|
||||
{
|
||||
"type": "ExpressionStatement",
|
||||
"start":7,"end":37,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":37}},
|
||||
"leadingComments": [
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 1 ",
|
||||
"start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}
|
||||
}
|
||||
],
|
||||
"trailingComments": [
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 5 ",
|
||||
"start":37,"end":44,"loc":{"start":{"line":1,"column":37},"end":{"line":1,"column":44}}
|
||||
}
|
||||
],
|
||||
"expression": {
|
||||
"type": "DoExpression",
|
||||
"start":7,"end":37,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":37}},
|
||||
"innerComments": [
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 2 ",
|
||||
"start":12,"end":19,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":19}}
|
||||
}
|
||||
],
|
||||
"async": true,
|
||||
"body": {
|
||||
"type": "BlockStatement",
|
||||
"start":28,"end":37,"loc":{"start":{"line":1,"column":28},"end":{"line":1,"column":37}},
|
||||
"leadingComments": [
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 3 ",
|
||||
"start":21,"end":28,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":28}}
|
||||
}
|
||||
],
|
||||
"innerComments": [
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 4 ",
|
||||
"start":29,"end":36,"loc":{"start":{"line":1,"column":29},"end":{"line":1,"column":36}}
|
||||
}
|
||||
],
|
||||
"body": [],
|
||||
"directives": []
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"directives": []
|
||||
},
|
||||
"comments": [
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 1 ",
|
||||
"start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}
|
||||
},
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 2 ",
|
||||
"start":12,"end":19,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":19}}
|
||||
},
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 3 ",
|
||||
"start":21,"end":28,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":28}}
|
||||
},
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 4 ",
|
||||
"start":29,"end":36,"loc":{"start":{"line":1,"column":29},"end":{"line":1,"column":36}}
|
||||
},
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 5 ",
|
||||
"start":37,"end":44,"loc":{"start":{"line":1,"column":37},"end":{"line":1,"column":44}}
|
||||
}
|
||||
]
|
||||
}
|
||||
1
packages/babel-parser/test/fixtures/comments/basic/async-function/input.js
vendored
Normal file
1
packages/babel-parser/test/fixtures/comments/basic/async-function/input.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
/* 1 */async/* 2 */function f () {}
|
||||
57
packages/babel-parser/test/fixtures/comments/basic/async-function/output.json
vendored
Normal file
57
packages/babel-parser/test/fixtures/comments/basic/async-function/output.json
vendored
Normal file
@@ -0,0 +1,57 @@
|
||||
{
|
||||
"type": "File",
|
||||
"start":0,"end":35,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":35}},
|
||||
"program": {
|
||||
"type": "Program",
|
||||
"start":0,"end":35,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":35}},
|
||||
"sourceType": "script",
|
||||
"interpreter": null,
|
||||
"body": [
|
||||
{
|
||||
"type": "FunctionDeclaration",
|
||||
"start":7,"end":35,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":35}},
|
||||
"leadingComments": [
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 1 ",
|
||||
"start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}
|
||||
}
|
||||
],
|
||||
"innerComments": [
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 2 ",
|
||||
"start":12,"end":19,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":19}}
|
||||
}
|
||||
],
|
||||
"id": {
|
||||
"type": "Identifier",
|
||||
"start":28,"end":29,"loc":{"start":{"line":1,"column":28},"end":{"line":1,"column":29},"identifierName":"f"},
|
||||
"name": "f"
|
||||
},
|
||||
"generator": false,
|
||||
"async": true,
|
||||
"params": [],
|
||||
"body": {
|
||||
"type": "BlockStatement",
|
||||
"start":33,"end":35,"loc":{"start":{"line":1,"column":33},"end":{"line":1,"column":35}},
|
||||
"body": [],
|
||||
"directives": []
|
||||
}
|
||||
}
|
||||
],
|
||||
"directives": []
|
||||
},
|
||||
"comments": [
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 1 ",
|
||||
"start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}
|
||||
},
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 2 ",
|
||||
"start":12,"end":19,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":19}}
|
||||
}
|
||||
]
|
||||
}
|
||||
1
packages/babel-parser/test/fixtures/comments/basic/call-expression-no-argument/input.js
vendored
Normal file
1
packages/babel-parser/test/fixtures/comments/basic/call-expression-no-argument/input.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
foo /* 1 */ (/* 2 */)
|
||||
53
packages/babel-parser/test/fixtures/comments/basic/call-expression-no-argument/output.json
vendored
Normal file
53
packages/babel-parser/test/fixtures/comments/basic/call-expression-no-argument/output.json
vendored
Normal file
@@ -0,0 +1,53 @@
|
||||
{
|
||||
"type": "File",
|
||||
"start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":21}},
|
||||
"program": {
|
||||
"type": "Program",
|
||||
"start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":21}},
|
||||
"sourceType": "script",
|
||||
"interpreter": null,
|
||||
"body": [
|
||||
{
|
||||
"type": "ExpressionStatement",
|
||||
"start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":21}},
|
||||
"expression": {
|
||||
"type": "CallExpression",
|
||||
"start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":21}},
|
||||
"innerComments": [
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 2 ",
|
||||
"start":13,"end":20,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":20}}
|
||||
}
|
||||
],
|
||||
"callee": {
|
||||
"type": "Identifier",
|
||||
"start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3},"identifierName":"foo"},
|
||||
"trailingComments": [
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 1 ",
|
||||
"start":4,"end":11,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":11}}
|
||||
}
|
||||
],
|
||||
"name": "foo"
|
||||
},
|
||||
"arguments": []
|
||||
}
|
||||
}
|
||||
],
|
||||
"directives": []
|
||||
},
|
||||
"comments": [
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 1 ",
|
||||
"start":4,"end":11,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":11}}
|
||||
},
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 2 ",
|
||||
"start":13,"end":20,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":20}}
|
||||
}
|
||||
]
|
||||
}
|
||||
3
packages/babel-parser/test/fixtures/comments/basic/class-accessor-computed/input.js
vendored
Normal file
3
packages/babel-parser/test/fixtures/comments/basic/class-accessor-computed/input.js
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
(class { /* 1 */ set /* 2 */ [ /* 3 */f/* 4 */] /* 5 */ (/* 6 */ a /* 7 */, /* 8 */) /* 9 */ {} });
|
||||
(class { /* 1 */ get /* 2 */ [ /* 3 */f/* 4 */] /* 5 */ (/* 6 */) /* 7 */ {} });
|
||||
(class { get /* 1 */ [f] () {} });
|
||||
343
packages/babel-parser/test/fixtures/comments/basic/class-accessor-computed/output.json
vendored
Normal file
343
packages/babel-parser/test/fixtures/comments/basic/class-accessor-computed/output.json
vendored
Normal file
@@ -0,0 +1,343 @@
|
||||
{
|
||||
"type": "File",
|
||||
"start":0,"end":215,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":34}},
|
||||
"program": {
|
||||
"type": "Program",
|
||||
"start":0,"end":215,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":34}},
|
||||
"sourceType": "script",
|
||||
"interpreter": null,
|
||||
"body": [
|
||||
{
|
||||
"type": "ExpressionStatement",
|
||||
"start":0,"end":99,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":99}},
|
||||
"expression": {
|
||||
"type": "ClassExpression",
|
||||
"start":1,"end":97,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":97}},
|
||||
"extra": {
|
||||
"parenthesized": true,
|
||||
"parenStart": 0
|
||||
},
|
||||
"id": null,
|
||||
"superClass": null,
|
||||
"body": {
|
||||
"type": "ClassBody",
|
||||
"start":7,"end":97,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":97}},
|
||||
"body": [
|
||||
{
|
||||
"type": "ClassMethod",
|
||||
"start":17,"end":95,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":95}},
|
||||
"leadingComments": [
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 1 ",
|
||||
"start":9,"end":16,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":16}}
|
||||
}
|
||||
],
|
||||
"innerComments": [
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 2 ",
|
||||
"start":21,"end":28,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":28}}
|
||||
},
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 5 ",
|
||||
"start":48,"end":55,"loc":{"start":{"line":1,"column":48},"end":{"line":1,"column":55}}
|
||||
}
|
||||
],
|
||||
"static": false,
|
||||
"key": {
|
||||
"type": "Identifier",
|
||||
"start":38,"end":39,"loc":{"start":{"line":1,"column":38},"end":{"line":1,"column":39},"identifierName":"f"},
|
||||
"leadingComments": [
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 3 ",
|
||||
"start":31,"end":38,"loc":{"start":{"line":1,"column":31},"end":{"line":1,"column":38}}
|
||||
}
|
||||
],
|
||||
"trailingComments": [
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 4 ",
|
||||
"start":39,"end":46,"loc":{"start":{"line":1,"column":39},"end":{"line":1,"column":46}}
|
||||
}
|
||||
],
|
||||
"name": "f"
|
||||
},
|
||||
"computed": true,
|
||||
"kind": "set",
|
||||
"id": null,
|
||||
"generator": false,
|
||||
"async": false,
|
||||
"params": [
|
||||
{
|
||||
"type": "Identifier",
|
||||
"start":65,"end":66,"loc":{"start":{"line":1,"column":65},"end":{"line":1,"column":66},"identifierName":"a"},
|
||||
"leadingComments": [
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 6 ",
|
||||
"start":57,"end":64,"loc":{"start":{"line":1,"column":57},"end":{"line":1,"column":64}}
|
||||
}
|
||||
],
|
||||
"trailingComments": [
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 7 ",
|
||||
"start":67,"end":74,"loc":{"start":{"line":1,"column":67},"end":{"line":1,"column":74}}
|
||||
},
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 8 ",
|
||||
"start":76,"end":83,"loc":{"start":{"line":1,"column":76},"end":{"line":1,"column":83}}
|
||||
}
|
||||
],
|
||||
"name": "a"
|
||||
}
|
||||
],
|
||||
"body": {
|
||||
"type": "BlockStatement",
|
||||
"start":93,"end":95,"loc":{"start":{"line":1,"column":93},"end":{"line":1,"column":95}},
|
||||
"leadingComments": [
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 9 ",
|
||||
"start":85,"end":92,"loc":{"start":{"line":1,"column":85},"end":{"line":1,"column":92}}
|
||||
}
|
||||
],
|
||||
"body": [],
|
||||
"directives": []
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "ExpressionStatement",
|
||||
"start":100,"end":180,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":80}},
|
||||
"expression": {
|
||||
"type": "ClassExpression",
|
||||
"start":101,"end":178,"loc":{"start":{"line":2,"column":1},"end":{"line":2,"column":78}},
|
||||
"extra": {
|
||||
"parenthesized": true,
|
||||
"parenStart": 100
|
||||
},
|
||||
"id": null,
|
||||
"superClass": null,
|
||||
"body": {
|
||||
"type": "ClassBody",
|
||||
"start":107,"end":178,"loc":{"start":{"line":2,"column":7},"end":{"line":2,"column":78}},
|
||||
"body": [
|
||||
{
|
||||
"type": "ClassMethod",
|
||||
"start":117,"end":176,"loc":{"start":{"line":2,"column":17},"end":{"line":2,"column":76}},
|
||||
"leadingComments": [
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 1 ",
|
||||
"start":109,"end":116,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":16}}
|
||||
}
|
||||
],
|
||||
"innerComments": [
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 2 ",
|
||||
"start":121,"end":128,"loc":{"start":{"line":2,"column":21},"end":{"line":2,"column":28}}
|
||||
},
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 5 ",
|
||||
"start":148,"end":155,"loc":{"start":{"line":2,"column":48},"end":{"line":2,"column":55}}
|
||||
},
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 6 ",
|
||||
"start":157,"end":164,"loc":{"start":{"line":2,"column":57},"end":{"line":2,"column":64}}
|
||||
}
|
||||
],
|
||||
"static": false,
|
||||
"key": {
|
||||
"type": "Identifier",
|
||||
"start":138,"end":139,"loc":{"start":{"line":2,"column":38},"end":{"line":2,"column":39},"identifierName":"f"},
|
||||
"leadingComments": [
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 3 ",
|
||||
"start":131,"end":138,"loc":{"start":{"line":2,"column":31},"end":{"line":2,"column":38}}
|
||||
}
|
||||
],
|
||||
"trailingComments": [
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 4 ",
|
||||
"start":139,"end":146,"loc":{"start":{"line":2,"column":39},"end":{"line":2,"column":46}}
|
||||
}
|
||||
],
|
||||
"name": "f"
|
||||
},
|
||||
"computed": true,
|
||||
"kind": "get",
|
||||
"id": null,
|
||||
"generator": false,
|
||||
"async": false,
|
||||
"params": [],
|
||||
"body": {
|
||||
"type": "BlockStatement",
|
||||
"start":174,"end":176,"loc":{"start":{"line":2,"column":74},"end":{"line":2,"column":76}},
|
||||
"leadingComments": [
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 7 ",
|
||||
"start":166,"end":173,"loc":{"start":{"line":2,"column":66},"end":{"line":2,"column":73}}
|
||||
}
|
||||
],
|
||||
"body": [],
|
||||
"directives": []
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "ExpressionStatement",
|
||||
"start":181,"end":215,"loc":{"start":{"line":3,"column":0},"end":{"line":3,"column":34}},
|
||||
"expression": {
|
||||
"type": "ClassExpression",
|
||||
"start":182,"end":213,"loc":{"start":{"line":3,"column":1},"end":{"line":3,"column":32}},
|
||||
"extra": {
|
||||
"parenthesized": true,
|
||||
"parenStart": 181
|
||||
},
|
||||
"id": null,
|
||||
"superClass": null,
|
||||
"body": {
|
||||
"type": "ClassBody",
|
||||
"start":188,"end":213,"loc":{"start":{"line":3,"column":7},"end":{"line":3,"column":32}},
|
||||
"body": [
|
||||
{
|
||||
"type": "ClassMethod",
|
||||
"start":190,"end":211,"loc":{"start":{"line":3,"column":9},"end":{"line":3,"column":30}},
|
||||
"innerComments": [
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 1 ",
|
||||
"start":194,"end":201,"loc":{"start":{"line":3,"column":13},"end":{"line":3,"column":20}}
|
||||
}
|
||||
],
|
||||
"static": false,
|
||||
"key": {
|
||||
"type": "Identifier",
|
||||
"start":203,"end":204,"loc":{"start":{"line":3,"column":22},"end":{"line":3,"column":23},"identifierName":"f"},
|
||||
"name": "f"
|
||||
},
|
||||
"computed": true,
|
||||
"kind": "get",
|
||||
"id": null,
|
||||
"generator": false,
|
||||
"async": false,
|
||||
"params": [],
|
||||
"body": {
|
||||
"type": "BlockStatement",
|
||||
"start":209,"end":211,"loc":{"start":{"line":3,"column":28},"end":{"line":3,"column":30}},
|
||||
"body": [],
|
||||
"directives": []
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"directives": []
|
||||
},
|
||||
"comments": [
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 1 ",
|
||||
"start":9,"end":16,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":16}}
|
||||
},
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 2 ",
|
||||
"start":21,"end":28,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":28}}
|
||||
},
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 3 ",
|
||||
"start":31,"end":38,"loc":{"start":{"line":1,"column":31},"end":{"line":1,"column":38}}
|
||||
},
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 4 ",
|
||||
"start":39,"end":46,"loc":{"start":{"line":1,"column":39},"end":{"line":1,"column":46}}
|
||||
},
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 5 ",
|
||||
"start":48,"end":55,"loc":{"start":{"line":1,"column":48},"end":{"line":1,"column":55}}
|
||||
},
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 6 ",
|
||||
"start":57,"end":64,"loc":{"start":{"line":1,"column":57},"end":{"line":1,"column":64}}
|
||||
},
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 7 ",
|
||||
"start":67,"end":74,"loc":{"start":{"line":1,"column":67},"end":{"line":1,"column":74}}
|
||||
},
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 8 ",
|
||||
"start":76,"end":83,"loc":{"start":{"line":1,"column":76},"end":{"line":1,"column":83}}
|
||||
},
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 9 ",
|
||||
"start":85,"end":92,"loc":{"start":{"line":1,"column":85},"end":{"line":1,"column":92}}
|
||||
},
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 1 ",
|
||||
"start":109,"end":116,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":16}}
|
||||
},
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 2 ",
|
||||
"start":121,"end":128,"loc":{"start":{"line":2,"column":21},"end":{"line":2,"column":28}}
|
||||
},
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 3 ",
|
||||
"start":131,"end":138,"loc":{"start":{"line":2,"column":31},"end":{"line":2,"column":38}}
|
||||
},
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 4 ",
|
||||
"start":139,"end":146,"loc":{"start":{"line":2,"column":39},"end":{"line":2,"column":46}}
|
||||
},
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 5 ",
|
||||
"start":148,"end":155,"loc":{"start":{"line":2,"column":48},"end":{"line":2,"column":55}}
|
||||
},
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 6 ",
|
||||
"start":157,"end":164,"loc":{"start":{"line":2,"column":57},"end":{"line":2,"column":64}}
|
||||
},
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 7 ",
|
||||
"start":166,"end":173,"loc":{"start":{"line":2,"column":66},"end":{"line":2,"column":73}}
|
||||
},
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 1 ",
|
||||
"start":194,"end":201,"loc":{"start":{"line":3,"column":13},"end":{"line":3,"column":20}}
|
||||
}
|
||||
]
|
||||
}
|
||||
2
packages/babel-parser/test/fixtures/comments/basic/class-method-async-generator/input.js
vendored
Normal file
2
packages/babel-parser/test/fixtures/comments/basic/class-method-async-generator/input.js
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
class C { /* 1 */ async /* 2 */ * /* 3 */ f /* 4 */ (/* 5 */ a /* 6 */, /* 7 */) /* 8 */ {} }
|
||||
(class { async /* 1 */ *f () {} });
|
||||
207
packages/babel-parser/test/fixtures/comments/basic/class-method-async-generator/output.json
vendored
Normal file
207
packages/babel-parser/test/fixtures/comments/basic/class-method-async-generator/output.json
vendored
Normal file
@@ -0,0 +1,207 @@
|
||||
{
|
||||
"type": "File",
|
||||
"start":0,"end":129,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":35}},
|
||||
"program": {
|
||||
"type": "Program",
|
||||
"start":0,"end":129,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":35}},
|
||||
"sourceType": "script",
|
||||
"interpreter": null,
|
||||
"body": [
|
||||
{
|
||||
"type": "ClassDeclaration",
|
||||
"start":0,"end":93,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":93}},
|
||||
"id": {
|
||||
"type": "Identifier",
|
||||
"start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"C"},
|
||||
"name": "C"
|
||||
},
|
||||
"superClass": null,
|
||||
"body": {
|
||||
"type": "ClassBody",
|
||||
"start":8,"end":93,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":93}},
|
||||
"body": [
|
||||
{
|
||||
"type": "ClassMethod",
|
||||
"start":18,"end":91,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":91}},
|
||||
"leadingComments": [
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 1 ",
|
||||
"start":10,"end":17,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":17}}
|
||||
}
|
||||
],
|
||||
"innerComments": [
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 2 ",
|
||||
"start":24,"end":31,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":31}}
|
||||
}
|
||||
],
|
||||
"static": false,
|
||||
"key": {
|
||||
"type": "Identifier",
|
||||
"start":42,"end":43,"loc":{"start":{"line":1,"column":42},"end":{"line":1,"column":43},"identifierName":"f"},
|
||||
"leadingComments": [
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 3 ",
|
||||
"start":34,"end":41,"loc":{"start":{"line":1,"column":34},"end":{"line":1,"column":41}}
|
||||
}
|
||||
],
|
||||
"trailingComments": [
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 4 ",
|
||||
"start":44,"end":51,"loc":{"start":{"line":1,"column":44},"end":{"line":1,"column":51}}
|
||||
}
|
||||
],
|
||||
"name": "f"
|
||||
},
|
||||
"computed": false,
|
||||
"kind": "method",
|
||||
"id": null,
|
||||
"generator": true,
|
||||
"async": true,
|
||||
"params": [
|
||||
{
|
||||
"type": "Identifier",
|
||||
"start":61,"end":62,"loc":{"start":{"line":1,"column":61},"end":{"line":1,"column":62},"identifierName":"a"},
|
||||
"leadingComments": [
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 5 ",
|
||||
"start":53,"end":60,"loc":{"start":{"line":1,"column":53},"end":{"line":1,"column":60}}
|
||||
}
|
||||
],
|
||||
"trailingComments": [
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 6 ",
|
||||
"start":63,"end":70,"loc":{"start":{"line":1,"column":63},"end":{"line":1,"column":70}}
|
||||
},
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 7 ",
|
||||
"start":72,"end":79,"loc":{"start":{"line":1,"column":72},"end":{"line":1,"column":79}}
|
||||
}
|
||||
],
|
||||
"name": "a"
|
||||
}
|
||||
],
|
||||
"body": {
|
||||
"type": "BlockStatement",
|
||||
"start":89,"end":91,"loc":{"start":{"line":1,"column":89},"end":{"line":1,"column":91}},
|
||||
"leadingComments": [
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 8 ",
|
||||
"start":81,"end":88,"loc":{"start":{"line":1,"column":81},"end":{"line":1,"column":88}}
|
||||
}
|
||||
],
|
||||
"body": [],
|
||||
"directives": []
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "ExpressionStatement",
|
||||
"start":94,"end":129,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":35}},
|
||||
"expression": {
|
||||
"type": "ClassExpression",
|
||||
"start":95,"end":127,"loc":{"start":{"line":2,"column":1},"end":{"line":2,"column":33}},
|
||||
"extra": {
|
||||
"parenthesized": true,
|
||||
"parenStart": 94
|
||||
},
|
||||
"id": null,
|
||||
"superClass": null,
|
||||
"body": {
|
||||
"type": "ClassBody",
|
||||
"start":101,"end":127,"loc":{"start":{"line":2,"column":7},"end":{"line":2,"column":33}},
|
||||
"body": [
|
||||
{
|
||||
"type": "ClassMethod",
|
||||
"start":103,"end":125,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":31}},
|
||||
"innerComments": [
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 1 ",
|
||||
"start":109,"end":116,"loc":{"start":{"line":2,"column":15},"end":{"line":2,"column":22}}
|
||||
}
|
||||
],
|
||||
"static": false,
|
||||
"key": {
|
||||
"type": "Identifier",
|
||||
"start":118,"end":119,"loc":{"start":{"line":2,"column":24},"end":{"line":2,"column":25},"identifierName":"f"},
|
||||
"name": "f"
|
||||
},
|
||||
"computed": false,
|
||||
"kind": "method",
|
||||
"id": null,
|
||||
"generator": true,
|
||||
"async": true,
|
||||
"params": [],
|
||||
"body": {
|
||||
"type": "BlockStatement",
|
||||
"start":123,"end":125,"loc":{"start":{"line":2,"column":29},"end":{"line":2,"column":31}},
|
||||
"body": [],
|
||||
"directives": []
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"directives": []
|
||||
},
|
||||
"comments": [
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 1 ",
|
||||
"start":10,"end":17,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":17}}
|
||||
},
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 2 ",
|
||||
"start":24,"end":31,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":31}}
|
||||
},
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 3 ",
|
||||
"start":34,"end":41,"loc":{"start":{"line":1,"column":34},"end":{"line":1,"column":41}}
|
||||
},
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 4 ",
|
||||
"start":44,"end":51,"loc":{"start":{"line":1,"column":44},"end":{"line":1,"column":51}}
|
||||
},
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 5 ",
|
||||
"start":53,"end":60,"loc":{"start":{"line":1,"column":53},"end":{"line":1,"column":60}}
|
||||
},
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 6 ",
|
||||
"start":63,"end":70,"loc":{"start":{"line":1,"column":63},"end":{"line":1,"column":70}}
|
||||
},
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 7 ",
|
||||
"start":72,"end":79,"loc":{"start":{"line":1,"column":72},"end":{"line":1,"column":79}}
|
||||
},
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 8 ",
|
||||
"start":81,"end":88,"loc":{"start":{"line":1,"column":81},"end":{"line":1,"column":88}}
|
||||
},
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 1 ",
|
||||
"start":109,"end":116,"loc":{"start":{"line":2,"column":15},"end":{"line":2,"column":22}}
|
||||
}
|
||||
]
|
||||
}
|
||||
2
packages/babel-parser/test/fixtures/comments/basic/class-method-static-generator/input.js
vendored
Normal file
2
packages/babel-parser/test/fixtures/comments/basic/class-method-static-generator/input.js
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
(class /* 1 */ { /* 2 */ static /* 3 */ * /* 4 */ f /* 5 */ (/* 6 */) /* 7 */ { /* 8 */ } /* 9 */ } /* 10 */);
|
||||
|
||||
175
packages/babel-parser/test/fixtures/comments/basic/class-method-static-generator/output.json
vendored
Normal file
175
packages/babel-parser/test/fixtures/comments/basic/class-method-static-generator/output.json
vendored
Normal file
@@ -0,0 +1,175 @@
|
||||
{
|
||||
"type": "File",
|
||||
"start":0,"end":110,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":110}},
|
||||
"program": {
|
||||
"type": "Program",
|
||||
"start":0,"end":110,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":110}},
|
||||
"sourceType": "script",
|
||||
"interpreter": null,
|
||||
"body": [
|
||||
{
|
||||
"type": "ExpressionStatement",
|
||||
"start":0,"end":110,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":110}},
|
||||
"expression": {
|
||||
"type": "ClassExpression",
|
||||
"start":1,"end":99,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":99}},
|
||||
"trailingComments": [
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 10 ",
|
||||
"start":100,"end":108,"loc":{"start":{"line":1,"column":100},"end":{"line":1,"column":108}}
|
||||
}
|
||||
],
|
||||
"extra": {
|
||||
"parenthesized": true,
|
||||
"parenStart": 0
|
||||
},
|
||||
"id": null,
|
||||
"superClass": null,
|
||||
"body": {
|
||||
"type": "ClassBody",
|
||||
"start":15,"end":99,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":99}},
|
||||
"leadingComments": [
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 1 ",
|
||||
"start":7,"end":14,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":14}}
|
||||
}
|
||||
],
|
||||
"body": [
|
||||
{
|
||||
"type": "ClassMethod",
|
||||
"start":25,"end":89,"loc":{"start":{"line":1,"column":25},"end":{"line":1,"column":89}},
|
||||
"leadingComments": [
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 2 ",
|
||||
"start":17,"end":24,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":24}}
|
||||
}
|
||||
],
|
||||
"trailingComments": [
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 9 ",
|
||||
"start":90,"end":97,"loc":{"start":{"line":1,"column":90},"end":{"line":1,"column":97}}
|
||||
}
|
||||
],
|
||||
"innerComments": [
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 3 ",
|
||||
"start":32,"end":39,"loc":{"start":{"line":1,"column":32},"end":{"line":1,"column":39}}
|
||||
},
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 6 ",
|
||||
"start":61,"end":68,"loc":{"start":{"line":1,"column":61},"end":{"line":1,"column":68}}
|
||||
}
|
||||
],
|
||||
"static": true,
|
||||
"kind": "method",
|
||||
"key": {
|
||||
"type": "Identifier",
|
||||
"start":50,"end":51,"loc":{"start":{"line":1,"column":50},"end":{"line":1,"column":51},"identifierName":"f"},
|
||||
"leadingComments": [
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 4 ",
|
||||
"start":42,"end":49,"loc":{"start":{"line":1,"column":42},"end":{"line":1,"column":49}}
|
||||
}
|
||||
],
|
||||
"trailingComments": [
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 5 ",
|
||||
"start":52,"end":59,"loc":{"start":{"line":1,"column":52},"end":{"line":1,"column":59}}
|
||||
}
|
||||
],
|
||||
"name": "f"
|
||||
},
|
||||
"computed": false,
|
||||
"id": null,
|
||||
"generator": true,
|
||||
"async": false,
|
||||
"params": [],
|
||||
"body": {
|
||||
"type": "BlockStatement",
|
||||
"start":78,"end":89,"loc":{"start":{"line":1,"column":78},"end":{"line":1,"column":89}},
|
||||
"leadingComments": [
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 7 ",
|
||||
"start":70,"end":77,"loc":{"start":{"line":1,"column":70},"end":{"line":1,"column":77}}
|
||||
}
|
||||
],
|
||||
"innerComments": [
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 8 ",
|
||||
"start":80,"end":87,"loc":{"start":{"line":1,"column":80},"end":{"line":1,"column":87}}
|
||||
}
|
||||
],
|
||||
"body": [],
|
||||
"directives": []
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"directives": []
|
||||
},
|
||||
"comments": [
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 1 ",
|
||||
"start":7,"end":14,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":14}}
|
||||
},
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 2 ",
|
||||
"start":17,"end":24,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":24}}
|
||||
},
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 3 ",
|
||||
"start":32,"end":39,"loc":{"start":{"line":1,"column":32},"end":{"line":1,"column":39}}
|
||||
},
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 4 ",
|
||||
"start":42,"end":49,"loc":{"start":{"line":1,"column":42},"end":{"line":1,"column":49}}
|
||||
},
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 5 ",
|
||||
"start":52,"end":59,"loc":{"start":{"line":1,"column":52},"end":{"line":1,"column":59}}
|
||||
},
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 6 ",
|
||||
"start":61,"end":68,"loc":{"start":{"line":1,"column":61},"end":{"line":1,"column":68}}
|
||||
},
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 7 ",
|
||||
"start":70,"end":77,"loc":{"start":{"line":1,"column":70},"end":{"line":1,"column":77}}
|
||||
},
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 8 ",
|
||||
"start":80,"end":87,"loc":{"start":{"line":1,"column":80},"end":{"line":1,"column":87}}
|
||||
},
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 9 ",
|
||||
"start":90,"end":97,"loc":{"start":{"line":1,"column":90},"end":{"line":1,"column":97}}
|
||||
},
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 10 ",
|
||||
"start":100,"end":108,"loc":{"start":{"line":1,"column":100},"end":{"line":1,"column":108}}
|
||||
}
|
||||
]
|
||||
}
|
||||
2
packages/babel-parser/test/fixtures/comments/basic/class-method/input.js
vendored
Normal file
2
packages/babel-parser/test/fixtures/comments/basic/class-method/input.js
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
(/* 1 */ class /* 2 */ { /* 3 */ f /* 4 */ (/* 5 */ a /* 6 */, /* 7 */) /* 8 */ { /* 9 */ } /* 10 */ } /* 11 */);
|
||||
(class /* 1 */ { /* 2 */ #f /* 3 */ (/* 4 */ a /* 5 */, /* 6 */) /* 7 */ { /* 8 */ } /* 9 */ } /* 10 */);
|
||||
362
packages/babel-parser/test/fixtures/comments/basic/class-method/output.json
vendored
Normal file
362
packages/babel-parser/test/fixtures/comments/basic/class-method/output.json
vendored
Normal file
@@ -0,0 +1,362 @@
|
||||
{
|
||||
"type": "File",
|
||||
"start":0,"end":219,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":105}},
|
||||
"program": {
|
||||
"type": "Program",
|
||||
"start":0,"end":219,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":105}},
|
||||
"sourceType": "script",
|
||||
"interpreter": null,
|
||||
"body": [
|
||||
{
|
||||
"type": "ExpressionStatement",
|
||||
"start":0,"end":113,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":113}},
|
||||
"expression": {
|
||||
"type": "ClassExpression",
|
||||
"start":9,"end":102,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":102}},
|
||||
"leadingComments": [
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 1 ",
|
||||
"start":1,"end":8,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":8}}
|
||||
}
|
||||
],
|
||||
"trailingComments": [
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 11 ",
|
||||
"start":103,"end":111,"loc":{"start":{"line":1,"column":103},"end":{"line":1,"column":111}}
|
||||
}
|
||||
],
|
||||
"extra": {
|
||||
"parenthesized": true,
|
||||
"parenStart": 0
|
||||
},
|
||||
"id": null,
|
||||
"superClass": null,
|
||||
"body": {
|
||||
"type": "ClassBody",
|
||||
"start":23,"end":102,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":102}},
|
||||
"leadingComments": [
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 2 ",
|
||||
"start":15,"end":22,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":22}}
|
||||
}
|
||||
],
|
||||
"body": [
|
||||
{
|
||||
"type": "ClassMethod",
|
||||
"start":33,"end":91,"loc":{"start":{"line":1,"column":33},"end":{"line":1,"column":91}},
|
||||
"leadingComments": [
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 3 ",
|
||||
"start":25,"end":32,"loc":{"start":{"line":1,"column":25},"end":{"line":1,"column":32}}
|
||||
}
|
||||
],
|
||||
"trailingComments": [
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 10 ",
|
||||
"start":92,"end":100,"loc":{"start":{"line":1,"column":92},"end":{"line":1,"column":100}}
|
||||
}
|
||||
],
|
||||
"static": false,
|
||||
"key": {
|
||||
"type": "Identifier",
|
||||
"start":33,"end":34,"loc":{"start":{"line":1,"column":33},"end":{"line":1,"column":34},"identifierName":"f"},
|
||||
"trailingComments": [
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 4 ",
|
||||
"start":35,"end":42,"loc":{"start":{"line":1,"column":35},"end":{"line":1,"column":42}}
|
||||
}
|
||||
],
|
||||
"name": "f"
|
||||
},
|
||||
"computed": false,
|
||||
"kind": "method",
|
||||
"id": null,
|
||||
"generator": false,
|
||||
"async": false,
|
||||
"params": [
|
||||
{
|
||||
"type": "Identifier",
|
||||
"start":52,"end":53,"loc":{"start":{"line":1,"column":52},"end":{"line":1,"column":53},"identifierName":"a"},
|
||||
"leadingComments": [
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 5 ",
|
||||
"start":44,"end":51,"loc":{"start":{"line":1,"column":44},"end":{"line":1,"column":51}}
|
||||
}
|
||||
],
|
||||
"trailingComments": [
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 6 ",
|
||||
"start":54,"end":61,"loc":{"start":{"line":1,"column":54},"end":{"line":1,"column":61}}
|
||||
},
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 7 ",
|
||||
"start":63,"end":70,"loc":{"start":{"line":1,"column":63},"end":{"line":1,"column":70}}
|
||||
}
|
||||
],
|
||||
"name": "a"
|
||||
}
|
||||
],
|
||||
"body": {
|
||||
"type": "BlockStatement",
|
||||
"start":80,"end":91,"loc":{"start":{"line":1,"column":80},"end":{"line":1,"column":91}},
|
||||
"leadingComments": [
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 8 ",
|
||||
"start":72,"end":79,"loc":{"start":{"line":1,"column":72},"end":{"line":1,"column":79}}
|
||||
}
|
||||
],
|
||||
"innerComments": [
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 9 ",
|
||||
"start":82,"end":89,"loc":{"start":{"line":1,"column":82},"end":{"line":1,"column":89}}
|
||||
}
|
||||
],
|
||||
"body": [],
|
||||
"directives": []
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "ExpressionStatement",
|
||||
"start":114,"end":219,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":105}},
|
||||
"expression": {
|
||||
"type": "ClassExpression",
|
||||
"start":115,"end":208,"loc":{"start":{"line":2,"column":1},"end":{"line":2,"column":94}},
|
||||
"trailingComments": [
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 10 ",
|
||||
"start":209,"end":217,"loc":{"start":{"line":2,"column":95},"end":{"line":2,"column":103}}
|
||||
}
|
||||
],
|
||||
"extra": {
|
||||
"parenthesized": true,
|
||||
"parenStart": 114
|
||||
},
|
||||
"id": null,
|
||||
"superClass": null,
|
||||
"body": {
|
||||
"type": "ClassBody",
|
||||
"start":129,"end":208,"loc":{"start":{"line":2,"column":15},"end":{"line":2,"column":94}},
|
||||
"leadingComments": [
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 1 ",
|
||||
"start":121,"end":128,"loc":{"start":{"line":2,"column":7},"end":{"line":2,"column":14}}
|
||||
}
|
||||
],
|
||||
"body": [
|
||||
{
|
||||
"type": "ClassPrivateMethod",
|
||||
"start":139,"end":198,"loc":{"start":{"line":2,"column":25},"end":{"line":2,"column":84}},
|
||||
"leadingComments": [
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 2 ",
|
||||
"start":131,"end":138,"loc":{"start":{"line":2,"column":17},"end":{"line":2,"column":24}}
|
||||
}
|
||||
],
|
||||
"trailingComments": [
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 9 ",
|
||||
"start":199,"end":206,"loc":{"start":{"line":2,"column":85},"end":{"line":2,"column":92}}
|
||||
}
|
||||
],
|
||||
"static": false,
|
||||
"key": {
|
||||
"type": "PrivateName",
|
||||
"start":139,"end":141,"loc":{"start":{"line":2,"column":25},"end":{"line":2,"column":27}},
|
||||
"trailingComments": [
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 3 ",
|
||||
"start":142,"end":149,"loc":{"start":{"line":2,"column":28},"end":{"line":2,"column":35}}
|
||||
}
|
||||
],
|
||||
"id": {
|
||||
"type": "Identifier",
|
||||
"start":140,"end":141,"loc":{"start":{"line":2,"column":26},"end":{"line":2,"column":27},"identifierName":"f"},
|
||||
"name": "f"
|
||||
}
|
||||
},
|
||||
"kind": "method",
|
||||
"id": null,
|
||||
"generator": false,
|
||||
"async": false,
|
||||
"params": [
|
||||
{
|
||||
"type": "Identifier",
|
||||
"start":159,"end":160,"loc":{"start":{"line":2,"column":45},"end":{"line":2,"column":46},"identifierName":"a"},
|
||||
"leadingComments": [
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 4 ",
|
||||
"start":151,"end":158,"loc":{"start":{"line":2,"column":37},"end":{"line":2,"column":44}}
|
||||
}
|
||||
],
|
||||
"trailingComments": [
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 5 ",
|
||||
"start":161,"end":168,"loc":{"start":{"line":2,"column":47},"end":{"line":2,"column":54}}
|
||||
},
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 6 ",
|
||||
"start":170,"end":177,"loc":{"start":{"line":2,"column":56},"end":{"line":2,"column":63}}
|
||||
}
|
||||
],
|
||||
"name": "a"
|
||||
}
|
||||
],
|
||||
"body": {
|
||||
"type": "BlockStatement",
|
||||
"start":187,"end":198,"loc":{"start":{"line":2,"column":73},"end":{"line":2,"column":84}},
|
||||
"leadingComments": [
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 7 ",
|
||||
"start":179,"end":186,"loc":{"start":{"line":2,"column":65},"end":{"line":2,"column":72}}
|
||||
}
|
||||
],
|
||||
"innerComments": [
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 8 ",
|
||||
"start":189,"end":196,"loc":{"start":{"line":2,"column":75},"end":{"line":2,"column":82}}
|
||||
}
|
||||
],
|
||||
"body": [],
|
||||
"directives": []
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"directives": []
|
||||
},
|
||||
"comments": [
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 1 ",
|
||||
"start":1,"end":8,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":8}}
|
||||
},
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 2 ",
|
||||
"start":15,"end":22,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":22}}
|
||||
},
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 3 ",
|
||||
"start":25,"end":32,"loc":{"start":{"line":1,"column":25},"end":{"line":1,"column":32}}
|
||||
},
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 4 ",
|
||||
"start":35,"end":42,"loc":{"start":{"line":1,"column":35},"end":{"line":1,"column":42}}
|
||||
},
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 5 ",
|
||||
"start":44,"end":51,"loc":{"start":{"line":1,"column":44},"end":{"line":1,"column":51}}
|
||||
},
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 6 ",
|
||||
"start":54,"end":61,"loc":{"start":{"line":1,"column":54},"end":{"line":1,"column":61}}
|
||||
},
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 7 ",
|
||||
"start":63,"end":70,"loc":{"start":{"line":1,"column":63},"end":{"line":1,"column":70}}
|
||||
},
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 8 ",
|
||||
"start":72,"end":79,"loc":{"start":{"line":1,"column":72},"end":{"line":1,"column":79}}
|
||||
},
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 9 ",
|
||||
"start":82,"end":89,"loc":{"start":{"line":1,"column":82},"end":{"line":1,"column":89}}
|
||||
},
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 10 ",
|
||||
"start":92,"end":100,"loc":{"start":{"line":1,"column":92},"end":{"line":1,"column":100}}
|
||||
},
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 11 ",
|
||||
"start":103,"end":111,"loc":{"start":{"line":1,"column":103},"end":{"line":1,"column":111}}
|
||||
},
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 1 ",
|
||||
"start":121,"end":128,"loc":{"start":{"line":2,"column":7},"end":{"line":2,"column":14}}
|
||||
},
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 2 ",
|
||||
"start":131,"end":138,"loc":{"start":{"line":2,"column":17},"end":{"line":2,"column":24}}
|
||||
},
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 3 ",
|
||||
"start":142,"end":149,"loc":{"start":{"line":2,"column":28},"end":{"line":2,"column":35}}
|
||||
},
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 4 ",
|
||||
"start":151,"end":158,"loc":{"start":{"line":2,"column":37},"end":{"line":2,"column":44}}
|
||||
},
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 5 ",
|
||||
"start":161,"end":168,"loc":{"start":{"line":2,"column":47},"end":{"line":2,"column":54}}
|
||||
},
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 6 ",
|
||||
"start":170,"end":177,"loc":{"start":{"line":2,"column":56},"end":{"line":2,"column":63}}
|
||||
},
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 7 ",
|
||||
"start":179,"end":186,"loc":{"start":{"line":2,"column":65},"end":{"line":2,"column":72}}
|
||||
},
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 8 ",
|
||||
"start":189,"end":196,"loc":{"start":{"line":2,"column":75},"end":{"line":2,"column":82}}
|
||||
},
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 9 ",
|
||||
"start":199,"end":206,"loc":{"start":{"line":2,"column":85},"end":{"line":2,"column":92}}
|
||||
},
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 10 ",
|
||||
"start":209,"end":217,"loc":{"start":{"line":2,"column":95},"end":{"line":2,"column":103}}
|
||||
}
|
||||
]
|
||||
}
|
||||
2
packages/babel-parser/test/fixtures/comments/basic/class-private-method/input.js
vendored
Normal file
2
packages/babel-parser/test/fixtures/comments/basic/class-private-method/input.js
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
(/* 1 */ class /* 2 */ { /* 3 */ #f /* 4 */ (/* 5 */ a /* 6 */, /* 7 */) /* 8 */ { /* 9 */ } /* 10 */ } /* 11 */);
|
||||
|
||||
196
packages/babel-parser/test/fixtures/comments/basic/class-private-method/output.json
vendored
Normal file
196
packages/babel-parser/test/fixtures/comments/basic/class-private-method/output.json
vendored
Normal file
@@ -0,0 +1,196 @@
|
||||
{
|
||||
"type": "File",
|
||||
"start":0,"end":114,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":114}},
|
||||
"program": {
|
||||
"type": "Program",
|
||||
"start":0,"end":114,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":114}},
|
||||
"sourceType": "script",
|
||||
"interpreter": null,
|
||||
"body": [
|
||||
{
|
||||
"type": "ExpressionStatement",
|
||||
"start":0,"end":114,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":114}},
|
||||
"expression": {
|
||||
"type": "ClassExpression",
|
||||
"start":9,"end":103,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":103}},
|
||||
"leadingComments": [
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 1 ",
|
||||
"start":1,"end":8,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":8}}
|
||||
}
|
||||
],
|
||||
"trailingComments": [
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 11 ",
|
||||
"start":104,"end":112,"loc":{"start":{"line":1,"column":104},"end":{"line":1,"column":112}}
|
||||
}
|
||||
],
|
||||
"extra": {
|
||||
"parenthesized": true,
|
||||
"parenStart": 0
|
||||
},
|
||||
"id": null,
|
||||
"superClass": null,
|
||||
"body": {
|
||||
"type": "ClassBody",
|
||||
"start":23,"end":103,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":103}},
|
||||
"leadingComments": [
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 2 ",
|
||||
"start":15,"end":22,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":22}}
|
||||
}
|
||||
],
|
||||
"body": [
|
||||
{
|
||||
"type": "ClassPrivateMethod",
|
||||
"start":33,"end":92,"loc":{"start":{"line":1,"column":33},"end":{"line":1,"column":92}},
|
||||
"leadingComments": [
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 3 ",
|
||||
"start":25,"end":32,"loc":{"start":{"line":1,"column":25},"end":{"line":1,"column":32}}
|
||||
}
|
||||
],
|
||||
"trailingComments": [
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 10 ",
|
||||
"start":93,"end":101,"loc":{"start":{"line":1,"column":93},"end":{"line":1,"column":101}}
|
||||
}
|
||||
],
|
||||
"static": false,
|
||||
"key": {
|
||||
"type": "PrivateName",
|
||||
"start":33,"end":35,"loc":{"start":{"line":1,"column":33},"end":{"line":1,"column":35}},
|
||||
"trailingComments": [
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 4 ",
|
||||
"start":36,"end":43,"loc":{"start":{"line":1,"column":36},"end":{"line":1,"column":43}}
|
||||
}
|
||||
],
|
||||
"id": {
|
||||
"type": "Identifier",
|
||||
"start":34,"end":35,"loc":{"start":{"line":1,"column":34},"end":{"line":1,"column":35},"identifierName":"f"},
|
||||
"name": "f"
|
||||
}
|
||||
},
|
||||
"kind": "method",
|
||||
"id": null,
|
||||
"generator": false,
|
||||
"async": false,
|
||||
"params": [
|
||||
{
|
||||
"type": "Identifier",
|
||||
"start":53,"end":54,"loc":{"start":{"line":1,"column":53},"end":{"line":1,"column":54},"identifierName":"a"},
|
||||
"leadingComments": [
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 5 ",
|
||||
"start":45,"end":52,"loc":{"start":{"line":1,"column":45},"end":{"line":1,"column":52}}
|
||||
}
|
||||
],
|
||||
"trailingComments": [
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 6 ",
|
||||
"start":55,"end":62,"loc":{"start":{"line":1,"column":55},"end":{"line":1,"column":62}}
|
||||
},
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 7 ",
|
||||
"start":64,"end":71,"loc":{"start":{"line":1,"column":64},"end":{"line":1,"column":71}}
|
||||
}
|
||||
],
|
||||
"name": "a"
|
||||
}
|
||||
],
|
||||
"body": {
|
||||
"type": "BlockStatement",
|
||||
"start":81,"end":92,"loc":{"start":{"line":1,"column":81},"end":{"line":1,"column":92}},
|
||||
"leadingComments": [
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 8 ",
|
||||
"start":73,"end":80,"loc":{"start":{"line":1,"column":73},"end":{"line":1,"column":80}}
|
||||
}
|
||||
],
|
||||
"innerComments": [
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 9 ",
|
||||
"start":83,"end":90,"loc":{"start":{"line":1,"column":83},"end":{"line":1,"column":90}}
|
||||
}
|
||||
],
|
||||
"body": [],
|
||||
"directives": []
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"directives": []
|
||||
},
|
||||
"comments": [
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 1 ",
|
||||
"start":1,"end":8,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":8}}
|
||||
},
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 2 ",
|
||||
"start":15,"end":22,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":22}}
|
||||
},
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 3 ",
|
||||
"start":25,"end":32,"loc":{"start":{"line":1,"column":25},"end":{"line":1,"column":32}}
|
||||
},
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 4 ",
|
||||
"start":36,"end":43,"loc":{"start":{"line":1,"column":36},"end":{"line":1,"column":43}}
|
||||
},
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 5 ",
|
||||
"start":45,"end":52,"loc":{"start":{"line":1,"column":45},"end":{"line":1,"column":52}}
|
||||
},
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 6 ",
|
||||
"start":55,"end":62,"loc":{"start":{"line":1,"column":55},"end":{"line":1,"column":62}}
|
||||
},
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 7 ",
|
||||
"start":64,"end":71,"loc":{"start":{"line":1,"column":64},"end":{"line":1,"column":71}}
|
||||
},
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 8 ",
|
||||
"start":73,"end":80,"loc":{"start":{"line":1,"column":73},"end":{"line":1,"column":80}}
|
||||
},
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 9 ",
|
||||
"start":83,"end":90,"loc":{"start":{"line":1,"column":83},"end":{"line":1,"column":90}}
|
||||
},
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 10 ",
|
||||
"start":93,"end":101,"loc":{"start":{"line":1,"column":93},"end":{"line":1,"column":101}}
|
||||
},
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 11 ",
|
||||
"start":104,"end":112,"loc":{"start":{"line":1,"column":104},"end":{"line":1,"column":112}}
|
||||
}
|
||||
]
|
||||
}
|
||||
1
packages/babel-parser/test/fixtures/comments/basic/class-static-block/input.js
vendored
Normal file
1
packages/babel-parser/test/fixtures/comments/basic/class-static-block/input.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
(class /* 1 */ { /* 2 */ static /* 3 */ {/* 4 */} /* 5 */ } /* 6 */);
|
||||
3
packages/babel-parser/test/fixtures/comments/basic/class-static-block/options.json
vendored
Normal file
3
packages/babel-parser/test/fixtures/comments/basic/class-static-block/options.json
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"plugins": ["classStaticBlock"]
|
||||
}
|
||||
110
packages/babel-parser/test/fixtures/comments/basic/class-static-block/output.json
vendored
Normal file
110
packages/babel-parser/test/fixtures/comments/basic/class-static-block/output.json
vendored
Normal file
@@ -0,0 +1,110 @@
|
||||
{
|
||||
"type": "File",
|
||||
"start":0,"end":69,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":69}},
|
||||
"program": {
|
||||
"type": "Program",
|
||||
"start":0,"end":69,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":69}},
|
||||
"sourceType": "script",
|
||||
"interpreter": null,
|
||||
"body": [
|
||||
{
|
||||
"type": "ExpressionStatement",
|
||||
"start":0,"end":69,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":69}},
|
||||
"expression": {
|
||||
"type": "ClassExpression",
|
||||
"start":1,"end":59,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":59}},
|
||||
"trailingComments": [
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 6 ",
|
||||
"start":60,"end":67,"loc":{"start":{"line":1,"column":60},"end":{"line":1,"column":67}}
|
||||
}
|
||||
],
|
||||
"extra": {
|
||||
"parenthesized": true,
|
||||
"parenStart": 0
|
||||
},
|
||||
"id": null,
|
||||
"superClass": null,
|
||||
"body": {
|
||||
"type": "ClassBody",
|
||||
"start":15,"end":59,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":59}},
|
||||
"leadingComments": [
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 1 ",
|
||||
"start":7,"end":14,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":14}}
|
||||
}
|
||||
],
|
||||
"body": [
|
||||
{
|
||||
"type": "StaticBlock",
|
||||
"start":25,"end":49,"loc":{"start":{"line":1,"column":25},"end":{"line":1,"column":49}},
|
||||
"leadingComments": [
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 2 ",
|
||||
"start":17,"end":24,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":24}}
|
||||
}
|
||||
],
|
||||
"trailingComments": [
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 5 ",
|
||||
"start":50,"end":57,"loc":{"start":{"line":1,"column":50},"end":{"line":1,"column":57}}
|
||||
}
|
||||
],
|
||||
"innerComments": [
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 3 ",
|
||||
"start":32,"end":39,"loc":{"start":{"line":1,"column":32},"end":{"line":1,"column":39}}
|
||||
},
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 4 ",
|
||||
"start":41,"end":48,"loc":{"start":{"line":1,"column":41},"end":{"line":1,"column":48}}
|
||||
}
|
||||
],
|
||||
"body": []
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"directives": []
|
||||
},
|
||||
"comments": [
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 1 ",
|
||||
"start":7,"end":14,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":14}}
|
||||
},
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 2 ",
|
||||
"start":17,"end":24,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":24}}
|
||||
},
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 3 ",
|
||||
"start":32,"end":39,"loc":{"start":{"line":1,"column":32},"end":{"line":1,"column":39}}
|
||||
},
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 4 ",
|
||||
"start":41,"end":48,"loc":{"start":{"line":1,"column":41},"end":{"line":1,"column":48}}
|
||||
},
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 5 ",
|
||||
"start":50,"end":57,"loc":{"start":{"line":1,"column":50},"end":{"line":1,"column":57}}
|
||||
},
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 6 ",
|
||||
"start":60,"end":67,"loc":{"start":{"line":1,"column":60},"end":{"line":1,"column":67}}
|
||||
}
|
||||
]
|
||||
}
|
||||
1
packages/babel-parser/test/fixtures/comments/basic/directive/input.js
vendored
Normal file
1
packages/babel-parser/test/fixtures/comments/basic/directive/input.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
/* 1 */"use strict"/* 2 */;/* 3 */
|
||||
64
packages/babel-parser/test/fixtures/comments/basic/directive/output.json
vendored
Normal file
64
packages/babel-parser/test/fixtures/comments/basic/directive/output.json
vendored
Normal file
@@ -0,0 +1,64 @@
|
||||
{
|
||||
"type": "File",
|
||||
"start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":34}},
|
||||
"program": {
|
||||
"type": "Program",
|
||||
"start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":34}},
|
||||
"sourceType": "script",
|
||||
"interpreter": null,
|
||||
"body": [],
|
||||
"directives": [
|
||||
{
|
||||
"type": "Directive",
|
||||
"start":7,"end":27,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":27}},
|
||||
"leadingComments": [
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 1 ",
|
||||
"start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}
|
||||
}
|
||||
],
|
||||
"trailingComments": [
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 3 ",
|
||||
"start":27,"end":34,"loc":{"start":{"line":1,"column":27},"end":{"line":1,"column":34}}
|
||||
}
|
||||
],
|
||||
"value": {
|
||||
"type": "DirectiveLiteral",
|
||||
"start":7,"end":19,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":19}},
|
||||
"trailingComments": [
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 2 ",
|
||||
"start":19,"end":26,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":26}}
|
||||
}
|
||||
],
|
||||
"extra": {
|
||||
"rawValue": "use strict",
|
||||
"raw": "\"use strict\""
|
||||
},
|
||||
"value": "use strict"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"comments": [
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 1 ",
|
||||
"start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}
|
||||
},
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 2 ",
|
||||
"start":19,"end":26,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":26}}
|
||||
},
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 3 ",
|
||||
"start":27,"end":34,"loc":{"start":{"line":1,"column":27},"end":{"line":1,"column":34}}
|
||||
}
|
||||
]
|
||||
}
|
||||
4
packages/babel-parser/test/fixtures/comments/basic/function/input.js
vendored
Normal file
4
packages/babel-parser/test/fixtures/comments/basic/function/input.js
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
/* 1 */ function /* 2 */ f /* 3 */ (/* 4 */ a /* 5 */, /* 6 */) /* 7 */ { /* 8 */ } /* 9 */
|
||||
(/* 1 */ function /* 2 */ f /* 3 */ (/* 4 */ a /* 5 */, /* 6 */) /* 7 */ { /* 8 */ } /* 9 */);
|
||||
|
||||
|
||||
290
packages/babel-parser/test/fixtures/comments/basic/function/output.json
vendored
Normal file
290
packages/babel-parser/test/fixtures/comments/basic/function/output.json
vendored
Normal file
@@ -0,0 +1,290 @@
|
||||
{
|
||||
"type": "File",
|
||||
"start":0,"end":186,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":94}},
|
||||
"program": {
|
||||
"type": "Program",
|
||||
"start":0,"end":186,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":94}},
|
||||
"sourceType": "script",
|
||||
"interpreter": null,
|
||||
"body": [
|
||||
{
|
||||
"type": "FunctionDeclaration",
|
||||
"start":8,"end":83,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":83}},
|
||||
"leadingComments": [
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 1 ",
|
||||
"start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}
|
||||
}
|
||||
],
|
||||
"trailingComments": [
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 9 ",
|
||||
"start":84,"end":91,"loc":{"start":{"line":1,"column":84},"end":{"line":1,"column":91}}
|
||||
}
|
||||
],
|
||||
"id": {
|
||||
"type": "Identifier",
|
||||
"start":25,"end":26,"loc":{"start":{"line":1,"column":25},"end":{"line":1,"column":26},"identifierName":"f"},
|
||||
"leadingComments": [
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 2 ",
|
||||
"start":17,"end":24,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":24}}
|
||||
}
|
||||
],
|
||||
"trailingComments": [
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 3 ",
|
||||
"start":27,"end":34,"loc":{"start":{"line":1,"column":27},"end":{"line":1,"column":34}}
|
||||
}
|
||||
],
|
||||
"name": "f"
|
||||
},
|
||||
"generator": false,
|
||||
"async": false,
|
||||
"params": [
|
||||
{
|
||||
"type": "Identifier",
|
||||
"start":44,"end":45,"loc":{"start":{"line":1,"column":44},"end":{"line":1,"column":45},"identifierName":"a"},
|
||||
"leadingComments": [
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 4 ",
|
||||
"start":36,"end":43,"loc":{"start":{"line":1,"column":36},"end":{"line":1,"column":43}}
|
||||
}
|
||||
],
|
||||
"trailingComments": [
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 5 ",
|
||||
"start":46,"end":53,"loc":{"start":{"line":1,"column":46},"end":{"line":1,"column":53}}
|
||||
},
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 6 ",
|
||||
"start":55,"end":62,"loc":{"start":{"line":1,"column":55},"end":{"line":1,"column":62}}
|
||||
}
|
||||
],
|
||||
"name": "a"
|
||||
}
|
||||
],
|
||||
"body": {
|
||||
"type": "BlockStatement",
|
||||
"start":72,"end":83,"loc":{"start":{"line":1,"column":72},"end":{"line":1,"column":83}},
|
||||
"leadingComments": [
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 7 ",
|
||||
"start":64,"end":71,"loc":{"start":{"line":1,"column":64},"end":{"line":1,"column":71}}
|
||||
}
|
||||
],
|
||||
"innerComments": [
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 8 ",
|
||||
"start":74,"end":81,"loc":{"start":{"line":1,"column":74},"end":{"line":1,"column":81}}
|
||||
}
|
||||
],
|
||||
"body": [],
|
||||
"directives": []
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "ExpressionStatement",
|
||||
"start":92,"end":186,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":94}},
|
||||
"leadingComments": [
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 9 ",
|
||||
"start":84,"end":91,"loc":{"start":{"line":1,"column":84},"end":{"line":1,"column":91}}
|
||||
}
|
||||
],
|
||||
"expression": {
|
||||
"type": "FunctionExpression",
|
||||
"start":101,"end":176,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":84}},
|
||||
"leadingComments": [
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 1 ",
|
||||
"start":93,"end":100,"loc":{"start":{"line":2,"column":1},"end":{"line":2,"column":8}}
|
||||
}
|
||||
],
|
||||
"trailingComments": [
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 9 ",
|
||||
"start":177,"end":184,"loc":{"start":{"line":2,"column":85},"end":{"line":2,"column":92}}
|
||||
}
|
||||
],
|
||||
"extra": {
|
||||
"parenthesized": true,
|
||||
"parenStart": 92
|
||||
},
|
||||
"id": {
|
||||
"type": "Identifier",
|
||||
"start":118,"end":119,"loc":{"start":{"line":2,"column":26},"end":{"line":2,"column":27},"identifierName":"f"},
|
||||
"leadingComments": [
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 2 ",
|
||||
"start":110,"end":117,"loc":{"start":{"line":2,"column":18},"end":{"line":2,"column":25}}
|
||||
}
|
||||
],
|
||||
"trailingComments": [
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 3 ",
|
||||
"start":120,"end":127,"loc":{"start":{"line":2,"column":28},"end":{"line":2,"column":35}}
|
||||
}
|
||||
],
|
||||
"name": "f"
|
||||
},
|
||||
"generator": false,
|
||||
"async": false,
|
||||
"params": [
|
||||
{
|
||||
"type": "Identifier",
|
||||
"start":137,"end":138,"loc":{"start":{"line":2,"column":45},"end":{"line":2,"column":46},"identifierName":"a"},
|
||||
"leadingComments": [
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 4 ",
|
||||
"start":129,"end":136,"loc":{"start":{"line":2,"column":37},"end":{"line":2,"column":44}}
|
||||
}
|
||||
],
|
||||
"trailingComments": [
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 5 ",
|
||||
"start":139,"end":146,"loc":{"start":{"line":2,"column":47},"end":{"line":2,"column":54}}
|
||||
},
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 6 ",
|
||||
"start":148,"end":155,"loc":{"start":{"line":2,"column":56},"end":{"line":2,"column":63}}
|
||||
}
|
||||
],
|
||||
"name": "a"
|
||||
}
|
||||
],
|
||||
"body": {
|
||||
"type": "BlockStatement",
|
||||
"start":165,"end":176,"loc":{"start":{"line":2,"column":73},"end":{"line":2,"column":84}},
|
||||
"leadingComments": [
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 7 ",
|
||||
"start":157,"end":164,"loc":{"start":{"line":2,"column":65},"end":{"line":2,"column":72}}
|
||||
}
|
||||
],
|
||||
"innerComments": [
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 8 ",
|
||||
"start":167,"end":174,"loc":{"start":{"line":2,"column":75},"end":{"line":2,"column":82}}
|
||||
}
|
||||
],
|
||||
"body": [],
|
||||
"directives": []
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"directives": []
|
||||
},
|
||||
"comments": [
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 1 ",
|
||||
"start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}
|
||||
},
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 2 ",
|
||||
"start":17,"end":24,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":24}}
|
||||
},
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 3 ",
|
||||
"start":27,"end":34,"loc":{"start":{"line":1,"column":27},"end":{"line":1,"column":34}}
|
||||
},
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 4 ",
|
||||
"start":36,"end":43,"loc":{"start":{"line":1,"column":36},"end":{"line":1,"column":43}}
|
||||
},
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 5 ",
|
||||
"start":46,"end":53,"loc":{"start":{"line":1,"column":46},"end":{"line":1,"column":53}}
|
||||
},
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 6 ",
|
||||
"start":55,"end":62,"loc":{"start":{"line":1,"column":55},"end":{"line":1,"column":62}}
|
||||
},
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 7 ",
|
||||
"start":64,"end":71,"loc":{"start":{"line":1,"column":64},"end":{"line":1,"column":71}}
|
||||
},
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 8 ",
|
||||
"start":74,"end":81,"loc":{"start":{"line":1,"column":74},"end":{"line":1,"column":81}}
|
||||
},
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 9 ",
|
||||
"start":84,"end":91,"loc":{"start":{"line":1,"column":84},"end":{"line":1,"column":91}}
|
||||
},
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 1 ",
|
||||
"start":93,"end":100,"loc":{"start":{"line":2,"column":1},"end":{"line":2,"column":8}}
|
||||
},
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 2 ",
|
||||
"start":110,"end":117,"loc":{"start":{"line":2,"column":18},"end":{"line":2,"column":25}}
|
||||
},
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 3 ",
|
||||
"start":120,"end":127,"loc":{"start":{"line":2,"column":28},"end":{"line":2,"column":35}}
|
||||
},
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 4 ",
|
||||
"start":129,"end":136,"loc":{"start":{"line":2,"column":37},"end":{"line":2,"column":44}}
|
||||
},
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 5 ",
|
||||
"start":139,"end":146,"loc":{"start":{"line":2,"column":47},"end":{"line":2,"column":54}}
|
||||
},
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 6 ",
|
||||
"start":148,"end":155,"loc":{"start":{"line":2,"column":56},"end":{"line":2,"column":63}}
|
||||
},
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 7 ",
|
||||
"start":157,"end":164,"loc":{"start":{"line":2,"column":65},"end":{"line":2,"column":72}}
|
||||
},
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 8 ",
|
||||
"start":167,"end":174,"loc":{"start":{"line":2,"column":75},"end":{"line":2,"column":82}}
|
||||
},
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 9 ",
|
||||
"start":177,"end":184,"loc":{"start":{"line":2,"column":85},"end":{"line":2,"column":92}}
|
||||
}
|
||||
]
|
||||
}
|
||||
3
packages/babel-parser/test/fixtures/comments/basic/object-accessor-computed/input.js
vendored
Normal file
3
packages/babel-parser/test/fixtures/comments/basic/object-accessor-computed/input.js
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
({ /* 1 */ set /* 2 */ [ /* 3 */f/* 4 */] /* 5 */ (/* 6 */ a /* 7 */, /* 8 */) /* 9 */ {} });
|
||||
({ /* 1 */ get /* 2 */ [ /* 3 */f/* 4 */] /* 5 */ (/* 6 */) /* 7 */ {} });
|
||||
({ get /* 1 */ [f] () {} });
|
||||
325
packages/babel-parser/test/fixtures/comments/basic/object-accessor-computed/output.json
vendored
Normal file
325
packages/babel-parser/test/fixtures/comments/basic/object-accessor-computed/output.json
vendored
Normal file
@@ -0,0 +1,325 @@
|
||||
{
|
||||
"type": "File",
|
||||
"start":0,"end":197,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":28}},
|
||||
"program": {
|
||||
"type": "Program",
|
||||
"start":0,"end":197,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":28}},
|
||||
"sourceType": "script",
|
||||
"interpreter": null,
|
||||
"body": [
|
||||
{
|
||||
"type": "ExpressionStatement",
|
||||
"start":0,"end":93,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":93}},
|
||||
"expression": {
|
||||
"type": "ObjectExpression",
|
||||
"start":1,"end":91,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":91}},
|
||||
"extra": {
|
||||
"parenthesized": true,
|
||||
"parenStart": 0
|
||||
},
|
||||
"properties": [
|
||||
{
|
||||
"type": "ObjectMethod",
|
||||
"start":11,"end":89,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":89}},
|
||||
"leadingComments": [
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 1 ",
|
||||
"start":3,"end":10,"loc":{"start":{"line":1,"column":3},"end":{"line":1,"column":10}}
|
||||
}
|
||||
],
|
||||
"innerComments": [
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 2 ",
|
||||
"start":15,"end":22,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":22}}
|
||||
},
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 5 ",
|
||||
"start":42,"end":49,"loc":{"start":{"line":1,"column":42},"end":{"line":1,"column":49}}
|
||||
}
|
||||
],
|
||||
"method": false,
|
||||
"key": {
|
||||
"type": "Identifier",
|
||||
"start":32,"end":33,"loc":{"start":{"line":1,"column":32},"end":{"line":1,"column":33},"identifierName":"f"},
|
||||
"leadingComments": [
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 3 ",
|
||||
"start":25,"end":32,"loc":{"start":{"line":1,"column":25},"end":{"line":1,"column":32}}
|
||||
}
|
||||
],
|
||||
"trailingComments": [
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 4 ",
|
||||
"start":33,"end":40,"loc":{"start":{"line":1,"column":33},"end":{"line":1,"column":40}}
|
||||
}
|
||||
],
|
||||
"name": "f"
|
||||
},
|
||||
"computed": true,
|
||||
"kind": "set",
|
||||
"id": null,
|
||||
"generator": false,
|
||||
"async": false,
|
||||
"params": [
|
||||
{
|
||||
"type": "Identifier",
|
||||
"start":59,"end":60,"loc":{"start":{"line":1,"column":59},"end":{"line":1,"column":60},"identifierName":"a"},
|
||||
"leadingComments": [
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 6 ",
|
||||
"start":51,"end":58,"loc":{"start":{"line":1,"column":51},"end":{"line":1,"column":58}}
|
||||
}
|
||||
],
|
||||
"trailingComments": [
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 7 ",
|
||||
"start":61,"end":68,"loc":{"start":{"line":1,"column":61},"end":{"line":1,"column":68}}
|
||||
},
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 8 ",
|
||||
"start":70,"end":77,"loc":{"start":{"line":1,"column":70},"end":{"line":1,"column":77}}
|
||||
}
|
||||
],
|
||||
"name": "a"
|
||||
}
|
||||
],
|
||||
"body": {
|
||||
"type": "BlockStatement",
|
||||
"start":87,"end":89,"loc":{"start":{"line":1,"column":87},"end":{"line":1,"column":89}},
|
||||
"leadingComments": [
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 9 ",
|
||||
"start":79,"end":86,"loc":{"start":{"line":1,"column":79},"end":{"line":1,"column":86}}
|
||||
}
|
||||
],
|
||||
"body": [],
|
||||
"directives": []
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "ExpressionStatement",
|
||||
"start":94,"end":168,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":74}},
|
||||
"expression": {
|
||||
"type": "ObjectExpression",
|
||||
"start":95,"end":166,"loc":{"start":{"line":2,"column":1},"end":{"line":2,"column":72}},
|
||||
"extra": {
|
||||
"parenthesized": true,
|
||||
"parenStart": 94
|
||||
},
|
||||
"properties": [
|
||||
{
|
||||
"type": "ObjectMethod",
|
||||
"start":105,"end":164,"loc":{"start":{"line":2,"column":11},"end":{"line":2,"column":70}},
|
||||
"leadingComments": [
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 1 ",
|
||||
"start":97,"end":104,"loc":{"start":{"line":2,"column":3},"end":{"line":2,"column":10}}
|
||||
}
|
||||
],
|
||||
"innerComments": [
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 2 ",
|
||||
"start":109,"end":116,"loc":{"start":{"line":2,"column":15},"end":{"line":2,"column":22}}
|
||||
},
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 5 ",
|
||||
"start":136,"end":143,"loc":{"start":{"line":2,"column":42},"end":{"line":2,"column":49}}
|
||||
},
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 6 ",
|
||||
"start":145,"end":152,"loc":{"start":{"line":2,"column":51},"end":{"line":2,"column":58}}
|
||||
}
|
||||
],
|
||||
"method": false,
|
||||
"key": {
|
||||
"type": "Identifier",
|
||||
"start":126,"end":127,"loc":{"start":{"line":2,"column":32},"end":{"line":2,"column":33},"identifierName":"f"},
|
||||
"leadingComments": [
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 3 ",
|
||||
"start":119,"end":126,"loc":{"start":{"line":2,"column":25},"end":{"line":2,"column":32}}
|
||||
}
|
||||
],
|
||||
"trailingComments": [
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 4 ",
|
||||
"start":127,"end":134,"loc":{"start":{"line":2,"column":33},"end":{"line":2,"column":40}}
|
||||
}
|
||||
],
|
||||
"name": "f"
|
||||
},
|
||||
"computed": true,
|
||||
"kind": "get",
|
||||
"id": null,
|
||||
"generator": false,
|
||||
"async": false,
|
||||
"params": [],
|
||||
"body": {
|
||||
"type": "BlockStatement",
|
||||
"start":162,"end":164,"loc":{"start":{"line":2,"column":68},"end":{"line":2,"column":70}},
|
||||
"leadingComments": [
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 7 ",
|
||||
"start":154,"end":161,"loc":{"start":{"line":2,"column":60},"end":{"line":2,"column":67}}
|
||||
}
|
||||
],
|
||||
"body": [],
|
||||
"directives": []
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "ExpressionStatement",
|
||||
"start":169,"end":197,"loc":{"start":{"line":3,"column":0},"end":{"line":3,"column":28}},
|
||||
"expression": {
|
||||
"type": "ObjectExpression",
|
||||
"start":170,"end":195,"loc":{"start":{"line":3,"column":1},"end":{"line":3,"column":26}},
|
||||
"extra": {
|
||||
"parenthesized": true,
|
||||
"parenStart": 169
|
||||
},
|
||||
"properties": [
|
||||
{
|
||||
"type": "ObjectMethod",
|
||||
"start":172,"end":193,"loc":{"start":{"line":3,"column":3},"end":{"line":3,"column":24}},
|
||||
"innerComments": [
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 1 ",
|
||||
"start":176,"end":183,"loc":{"start":{"line":3,"column":7},"end":{"line":3,"column":14}}
|
||||
}
|
||||
],
|
||||
"method": false,
|
||||
"key": {
|
||||
"type": "Identifier",
|
||||
"start":185,"end":186,"loc":{"start":{"line":3,"column":16},"end":{"line":3,"column":17},"identifierName":"f"},
|
||||
"name": "f"
|
||||
},
|
||||
"computed": true,
|
||||
"kind": "get",
|
||||
"id": null,
|
||||
"generator": false,
|
||||
"async": false,
|
||||
"params": [],
|
||||
"body": {
|
||||
"type": "BlockStatement",
|
||||
"start":191,"end":193,"loc":{"start":{"line":3,"column":22},"end":{"line":3,"column":24}},
|
||||
"body": [],
|
||||
"directives": []
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
],
|
||||
"directives": []
|
||||
},
|
||||
"comments": [
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 1 ",
|
||||
"start":3,"end":10,"loc":{"start":{"line":1,"column":3},"end":{"line":1,"column":10}}
|
||||
},
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 2 ",
|
||||
"start":15,"end":22,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":22}}
|
||||
},
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 3 ",
|
||||
"start":25,"end":32,"loc":{"start":{"line":1,"column":25},"end":{"line":1,"column":32}}
|
||||
},
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 4 ",
|
||||
"start":33,"end":40,"loc":{"start":{"line":1,"column":33},"end":{"line":1,"column":40}}
|
||||
},
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 5 ",
|
||||
"start":42,"end":49,"loc":{"start":{"line":1,"column":42},"end":{"line":1,"column":49}}
|
||||
},
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 6 ",
|
||||
"start":51,"end":58,"loc":{"start":{"line":1,"column":51},"end":{"line":1,"column":58}}
|
||||
},
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 7 ",
|
||||
"start":61,"end":68,"loc":{"start":{"line":1,"column":61},"end":{"line":1,"column":68}}
|
||||
},
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 8 ",
|
||||
"start":70,"end":77,"loc":{"start":{"line":1,"column":70},"end":{"line":1,"column":77}}
|
||||
},
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 9 ",
|
||||
"start":79,"end":86,"loc":{"start":{"line":1,"column":79},"end":{"line":1,"column":86}}
|
||||
},
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 1 ",
|
||||
"start":97,"end":104,"loc":{"start":{"line":2,"column":3},"end":{"line":2,"column":10}}
|
||||
},
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 2 ",
|
||||
"start":109,"end":116,"loc":{"start":{"line":2,"column":15},"end":{"line":2,"column":22}}
|
||||
},
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 3 ",
|
||||
"start":119,"end":126,"loc":{"start":{"line":2,"column":25},"end":{"line":2,"column":32}}
|
||||
},
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 4 ",
|
||||
"start":127,"end":134,"loc":{"start":{"line":2,"column":33},"end":{"line":2,"column":40}}
|
||||
},
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 5 ",
|
||||
"start":136,"end":143,"loc":{"start":{"line":2,"column":42},"end":{"line":2,"column":49}}
|
||||
},
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 6 ",
|
||||
"start":145,"end":152,"loc":{"start":{"line":2,"column":51},"end":{"line":2,"column":58}}
|
||||
},
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 7 ",
|
||||
"start":154,"end":161,"loc":{"start":{"line":2,"column":60},"end":{"line":2,"column":67}}
|
||||
},
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 1 ",
|
||||
"start":176,"end":183,"loc":{"start":{"line":3,"column":7},"end":{"line":3,"column":14}}
|
||||
}
|
||||
]
|
||||
}
|
||||
2
packages/babel-parser/test/fixtures/comments/basic/object-method-async-generator/input.js
vendored
Normal file
2
packages/babel-parser/test/fixtures/comments/basic/object-method-async-generator/input.js
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
({ /* 1 */ async /* 2 */ * /* 3 */ f /* 4 */ (/* 5 */ a /* 6 */, /* 7 */) /* 8 */ {} })
|
||||
({ async /* 1 */ *f () {} });
|
||||
197
packages/babel-parser/test/fixtures/comments/basic/object-method-async-generator/output.json
vendored
Normal file
197
packages/babel-parser/test/fixtures/comments/basic/object-method-async-generator/output.json
vendored
Normal file
@@ -0,0 +1,197 @@
|
||||
{
|
||||
"type": "File",
|
||||
"start":0,"end":117,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":29}},
|
||||
"program": {
|
||||
"type": "Program",
|
||||
"start":0,"end":117,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":29}},
|
||||
"sourceType": "script",
|
||||
"interpreter": null,
|
||||
"body": [
|
||||
{
|
||||
"type": "ExpressionStatement",
|
||||
"start":0,"end":117,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":29}},
|
||||
"expression": {
|
||||
"type": "CallExpression",
|
||||
"start":0,"end":116,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":28}},
|
||||
"callee": {
|
||||
"type": "ObjectExpression",
|
||||
"start":1,"end":86,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":86}},
|
||||
"extra": {
|
||||
"parenthesized": true,
|
||||
"parenStart": 0
|
||||
},
|
||||
"properties": [
|
||||
{
|
||||
"type": "ObjectMethod",
|
||||
"start":11,"end":84,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":84}},
|
||||
"leadingComments": [
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 1 ",
|
||||
"start":3,"end":10,"loc":{"start":{"line":1,"column":3},"end":{"line":1,"column":10}}
|
||||
}
|
||||
],
|
||||
"innerComments": [
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 2 ",
|
||||
"start":17,"end":24,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":24}}
|
||||
}
|
||||
],
|
||||
"method": true,
|
||||
"key": {
|
||||
"type": "Identifier",
|
||||
"start":35,"end":36,"loc":{"start":{"line":1,"column":35},"end":{"line":1,"column":36},"identifierName":"f"},
|
||||
"leadingComments": [
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 3 ",
|
||||
"start":27,"end":34,"loc":{"start":{"line":1,"column":27},"end":{"line":1,"column":34}}
|
||||
}
|
||||
],
|
||||
"trailingComments": [
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 4 ",
|
||||
"start":37,"end":44,"loc":{"start":{"line":1,"column":37},"end":{"line":1,"column":44}}
|
||||
}
|
||||
],
|
||||
"name": "f"
|
||||
},
|
||||
"computed": false,
|
||||
"kind": "method",
|
||||
"id": null,
|
||||
"generator": true,
|
||||
"async": true,
|
||||
"params": [
|
||||
{
|
||||
"type": "Identifier",
|
||||
"start":54,"end":55,"loc":{"start":{"line":1,"column":54},"end":{"line":1,"column":55},"identifierName":"a"},
|
||||
"leadingComments": [
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 5 ",
|
||||
"start":46,"end":53,"loc":{"start":{"line":1,"column":46},"end":{"line":1,"column":53}}
|
||||
}
|
||||
],
|
||||
"trailingComments": [
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 6 ",
|
||||
"start":56,"end":63,"loc":{"start":{"line":1,"column":56},"end":{"line":1,"column":63}}
|
||||
},
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 7 ",
|
||||
"start":65,"end":72,"loc":{"start":{"line":1,"column":65},"end":{"line":1,"column":72}}
|
||||
}
|
||||
],
|
||||
"name": "a"
|
||||
}
|
||||
],
|
||||
"body": {
|
||||
"type": "BlockStatement",
|
||||
"start":82,"end":84,"loc":{"start":{"line":1,"column":82},"end":{"line":1,"column":84}},
|
||||
"leadingComments": [
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 8 ",
|
||||
"start":74,"end":81,"loc":{"start":{"line":1,"column":74},"end":{"line":1,"column":81}}
|
||||
}
|
||||
],
|
||||
"body": [],
|
||||
"directives": []
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"arguments": [
|
||||
{
|
||||
"type": "ObjectExpression",
|
||||
"start":89,"end":115,"loc":{"start":{"line":2,"column":1},"end":{"line":2,"column":27}},
|
||||
"properties": [
|
||||
{
|
||||
"type": "ObjectMethod",
|
||||
"start":91,"end":113,"loc":{"start":{"line":2,"column":3},"end":{"line":2,"column":25}},
|
||||
"innerComments": [
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 1 ",
|
||||
"start":97,"end":104,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":16}}
|
||||
}
|
||||
],
|
||||
"method": true,
|
||||
"key": {
|
||||
"type": "Identifier",
|
||||
"start":106,"end":107,"loc":{"start":{"line":2,"column":18},"end":{"line":2,"column":19},"identifierName":"f"},
|
||||
"name": "f"
|
||||
},
|
||||
"computed": false,
|
||||
"kind": "method",
|
||||
"id": null,
|
||||
"generator": true,
|
||||
"async": true,
|
||||
"params": [],
|
||||
"body": {
|
||||
"type": "BlockStatement",
|
||||
"start":111,"end":113,"loc":{"start":{"line":2,"column":23},"end":{"line":2,"column":25}},
|
||||
"body": [],
|
||||
"directives": []
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
],
|
||||
"directives": []
|
||||
},
|
||||
"comments": [
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 1 ",
|
||||
"start":3,"end":10,"loc":{"start":{"line":1,"column":3},"end":{"line":1,"column":10}}
|
||||
},
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 2 ",
|
||||
"start":17,"end":24,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":24}}
|
||||
},
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 3 ",
|
||||
"start":27,"end":34,"loc":{"start":{"line":1,"column":27},"end":{"line":1,"column":34}}
|
||||
},
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 4 ",
|
||||
"start":37,"end":44,"loc":{"start":{"line":1,"column":37},"end":{"line":1,"column":44}}
|
||||
},
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 5 ",
|
||||
"start":46,"end":53,"loc":{"start":{"line":1,"column":46},"end":{"line":1,"column":53}}
|
||||
},
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 6 ",
|
||||
"start":56,"end":63,"loc":{"start":{"line":1,"column":56},"end":{"line":1,"column":63}}
|
||||
},
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 7 ",
|
||||
"start":65,"end":72,"loc":{"start":{"line":1,"column":65},"end":{"line":1,"column":72}}
|
||||
},
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 8 ",
|
||||
"start":74,"end":81,"loc":{"start":{"line":1,"column":74},"end":{"line":1,"column":81}}
|
||||
},
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 1 ",
|
||||
"start":97,"end":104,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":16}}
|
||||
}
|
||||
]
|
||||
}
|
||||
1
packages/babel-parser/test/fixtures/comments/basic/object-method/input.js
vendored
Normal file
1
packages/babel-parser/test/fixtures/comments/basic/object-method/input.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
(/* 1 */ { /* 2 */ f /* 3 */ (/* 4 */ a /* 5 */, /* 6 */) /* 7 */ { /* 8 */ } /* 9 */ } /* 10 */);
|
||||
175
packages/babel-parser/test/fixtures/comments/basic/object-method/output.json
vendored
Normal file
175
packages/babel-parser/test/fixtures/comments/basic/object-method/output.json
vendored
Normal file
@@ -0,0 +1,175 @@
|
||||
{
|
||||
"type": "File",
|
||||
"start":0,"end":98,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":98}},
|
||||
"program": {
|
||||
"type": "Program",
|
||||
"start":0,"end":98,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":98}},
|
||||
"sourceType": "script",
|
||||
"interpreter": null,
|
||||
"body": [
|
||||
{
|
||||
"type": "ExpressionStatement",
|
||||
"start":0,"end":98,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":98}},
|
||||
"expression": {
|
||||
"type": "ObjectExpression",
|
||||
"start":9,"end":87,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":87}},
|
||||
"leadingComments": [
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 1 ",
|
||||
"start":1,"end":8,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":8}}
|
||||
}
|
||||
],
|
||||
"trailingComments": [
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 10 ",
|
||||
"start":88,"end":96,"loc":{"start":{"line":1,"column":88},"end":{"line":1,"column":96}}
|
||||
}
|
||||
],
|
||||
"extra": {
|
||||
"parenthesized": true,
|
||||
"parenStart": 0
|
||||
},
|
||||
"properties": [
|
||||
{
|
||||
"type": "ObjectMethod",
|
||||
"start":19,"end":77,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":77}},
|
||||
"leadingComments": [
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 2 ",
|
||||
"start":11,"end":18,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":18}}
|
||||
}
|
||||
],
|
||||
"trailingComments": [
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 9 ",
|
||||
"start":78,"end":85,"loc":{"start":{"line":1,"column":78},"end":{"line":1,"column":85}}
|
||||
}
|
||||
],
|
||||
"method": true,
|
||||
"key": {
|
||||
"type": "Identifier",
|
||||
"start":19,"end":20,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":20},"identifierName":"f"},
|
||||
"trailingComments": [
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 3 ",
|
||||
"start":21,"end":28,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":28}}
|
||||
}
|
||||
],
|
||||
"name": "f"
|
||||
},
|
||||
"computed": false,
|
||||
"kind": "method",
|
||||
"id": null,
|
||||
"generator": false,
|
||||
"async": false,
|
||||
"params": [
|
||||
{
|
||||
"type": "Identifier",
|
||||
"start":38,"end":39,"loc":{"start":{"line":1,"column":38},"end":{"line":1,"column":39},"identifierName":"a"},
|
||||
"leadingComments": [
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 4 ",
|
||||
"start":30,"end":37,"loc":{"start":{"line":1,"column":30},"end":{"line":1,"column":37}}
|
||||
}
|
||||
],
|
||||
"trailingComments": [
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 5 ",
|
||||
"start":40,"end":47,"loc":{"start":{"line":1,"column":40},"end":{"line":1,"column":47}}
|
||||
},
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 6 ",
|
||||
"start":49,"end":56,"loc":{"start":{"line":1,"column":49},"end":{"line":1,"column":56}}
|
||||
}
|
||||
],
|
||||
"name": "a"
|
||||
}
|
||||
],
|
||||
"body": {
|
||||
"type": "BlockStatement",
|
||||
"start":66,"end":77,"loc":{"start":{"line":1,"column":66},"end":{"line":1,"column":77}},
|
||||
"leadingComments": [
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 7 ",
|
||||
"start":58,"end":65,"loc":{"start":{"line":1,"column":58},"end":{"line":1,"column":65}}
|
||||
}
|
||||
],
|
||||
"innerComments": [
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 8 ",
|
||||
"start":68,"end":75,"loc":{"start":{"line":1,"column":68},"end":{"line":1,"column":75}}
|
||||
}
|
||||
],
|
||||
"body": [],
|
||||
"directives": []
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
],
|
||||
"directives": []
|
||||
},
|
||||
"comments": [
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 1 ",
|
||||
"start":1,"end":8,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":8}}
|
||||
},
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 2 ",
|
||||
"start":11,"end":18,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":18}}
|
||||
},
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 3 ",
|
||||
"start":21,"end":28,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":28}}
|
||||
},
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 4 ",
|
||||
"start":30,"end":37,"loc":{"start":{"line":1,"column":30},"end":{"line":1,"column":37}}
|
||||
},
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 5 ",
|
||||
"start":40,"end":47,"loc":{"start":{"line":1,"column":40},"end":{"line":1,"column":47}}
|
||||
},
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 6 ",
|
||||
"start":49,"end":56,"loc":{"start":{"line":1,"column":49},"end":{"line":1,"column":56}}
|
||||
},
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 7 ",
|
||||
"start":58,"end":65,"loc":{"start":{"line":1,"column":58},"end":{"line":1,"column":65}}
|
||||
},
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 8 ",
|
||||
"start":68,"end":75,"loc":{"start":{"line":1,"column":68},"end":{"line":1,"column":75}}
|
||||
},
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 9 ",
|
||||
"start":78,"end":85,"loc":{"start":{"line":1,"column":78},"end":{"line":1,"column":85}}
|
||||
},
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 10 ",
|
||||
"start":88,"end":96,"loc":{"start":{"line":1,"column":88},"end":{"line":1,"column":96}}
|
||||
}
|
||||
]
|
||||
}
|
||||
1
packages/babel-parser/test/fixtures/comments/basic/sequence-expression/input.js
vendored
Normal file
1
packages/babel-parser/test/fixtures/comments/basic/sequence-expression/input.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
/* 1 */ (/* 2 */ ( /* 3 */ a /* 4 */, /* 5 */ b /* 6 */ ) /* 7 */ ) /* 8 */; /* 9 */
|
||||
145
packages/babel-parser/test/fixtures/comments/basic/sequence-expression/output.json
vendored
Normal file
145
packages/babel-parser/test/fixtures/comments/basic/sequence-expression/output.json
vendored
Normal file
@@ -0,0 +1,145 @@
|
||||
{
|
||||
"type": "File",
|
||||
"start":0,"end":84,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":84}},
|
||||
"program": {
|
||||
"type": "Program",
|
||||
"start":0,"end":84,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":84}},
|
||||
"sourceType": "script",
|
||||
"interpreter": null,
|
||||
"body": [
|
||||
{
|
||||
"type": "ExpressionStatement",
|
||||
"start":8,"end":76,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":76}},
|
||||
"leadingComments": [
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 1 ",
|
||||
"start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}
|
||||
}
|
||||
],
|
||||
"trailingComments": [
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 9 ",
|
||||
"start":77,"end":84,"loc":{"start":{"line":1,"column":77},"end":{"line":1,"column":84}}
|
||||
}
|
||||
],
|
||||
"innerComments": [
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 2 ",
|
||||
"start":9,"end":16,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":16}}
|
||||
},
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 8 ",
|
||||
"start":68,"end":75,"loc":{"start":{"line":1,"column":68},"end":{"line":1,"column":75}}
|
||||
}
|
||||
],
|
||||
"expression": {
|
||||
"type": "SequenceExpression",
|
||||
"start":27,"end":47,"loc":{"start":{"line":1,"column":27},"end":{"line":1,"column":47}},
|
||||
"leadingComments": [
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 3 ",
|
||||
"start":19,"end":26,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":26}}
|
||||
}
|
||||
],
|
||||
"trailingComments": [
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 7 ",
|
||||
"start":58,"end":65,"loc":{"start":{"line":1,"column":58},"end":{"line":1,"column":65}}
|
||||
}
|
||||
],
|
||||
"extra": {
|
||||
"parenthesized": true,
|
||||
"parenStart": 8
|
||||
},
|
||||
"expressions": [
|
||||
{
|
||||
"type": "Identifier",
|
||||
"start":27,"end":28,"loc":{"start":{"line":1,"column":27},"end":{"line":1,"column":28},"identifierName":"a"},
|
||||
"trailingComments": [
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 4 ",
|
||||
"start":29,"end":36,"loc":{"start":{"line":1,"column":29},"end":{"line":1,"column":36}}
|
||||
}
|
||||
],
|
||||
"name": "a"
|
||||
},
|
||||
{
|
||||
"type": "Identifier",
|
||||
"start":46,"end":47,"loc":{"start":{"line":1,"column":46},"end":{"line":1,"column":47},"identifierName":"b"},
|
||||
"leadingComments": [
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 5 ",
|
||||
"start":38,"end":45,"loc":{"start":{"line":1,"column":38},"end":{"line":1,"column":45}}
|
||||
}
|
||||
],
|
||||
"trailingComments": [
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 6 ",
|
||||
"start":48,"end":55,"loc":{"start":{"line":1,"column":48},"end":{"line":1,"column":55}}
|
||||
}
|
||||
],
|
||||
"name": "b"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
],
|
||||
"directives": []
|
||||
},
|
||||
"comments": [
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 1 ",
|
||||
"start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}
|
||||
},
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 2 ",
|
||||
"start":9,"end":16,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":16}}
|
||||
},
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 3 ",
|
||||
"start":19,"end":26,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":26}}
|
||||
},
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 4 ",
|
||||
"start":29,"end":36,"loc":{"start":{"line":1,"column":29},"end":{"line":1,"column":36}}
|
||||
},
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 5 ",
|
||||
"start":38,"end":45,"loc":{"start":{"line":1,"column":38},"end":{"line":1,"column":45}}
|
||||
},
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 6 ",
|
||||
"start":48,"end":55,"loc":{"start":{"line":1,"column":48},"end":{"line":1,"column":55}}
|
||||
},
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 7 ",
|
||||
"start":58,"end":65,"loc":{"start":{"line":1,"column":58},"end":{"line":1,"column":65}}
|
||||
},
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 8 ",
|
||||
"start":68,"end":75,"loc":{"start":{"line":1,"column":68},"end":{"line":1,"column":75}}
|
||||
},
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " 9 ",
|
||||
"start":77,"end":84,"loc":{"start":{"line":1,"column":77},"end":{"line":1,"column":84}}
|
||||
}
|
||||
]
|
||||
}
|
||||
6
packages/babel-parser/test/fixtures/comments/basic/switch-case/input.js
vendored
Normal file
6
packages/babel-parser/test/fixtures/comments/basic/switch-case/input.js
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
/*-1*/ foo /*0*/ : /*1*/ switch /*2*/ ( /*3*/ false /*4*/ ) /*5*/ {
|
||||
/*6*/ case /*7*/ false /*8*/ : /*9*/
|
||||
break /*10*/ foo /*11*/ ;
|
||||
/*12*/ default /*13*/ : /*14*/
|
||||
case /*15*/ false /*16*/ : /*17*/ { /*18*/ } /*19*/
|
||||
}
|
||||
342
packages/babel-parser/test/fixtures/comments/basic/switch-case/output.json
vendored
Normal file
342
packages/babel-parser/test/fixtures/comments/basic/switch-case/output.json
vendored
Normal file
@@ -0,0 +1,342 @@
|
||||
{
|
||||
"type": "File",
|
||||
"start":0,"end":233,"loc":{"start":{"line":1,"column":0},"end":{"line":6,"column":3}},
|
||||
"program": {
|
||||
"type": "Program",
|
||||
"start":0,"end":233,"loc":{"start":{"line":1,"column":0},"end":{"line":6,"column":3}},
|
||||
"sourceType": "script",
|
||||
"interpreter": null,
|
||||
"body": [
|
||||
{
|
||||
"type": "LabeledStatement",
|
||||
"start":7,"end":233,"loc":{"start":{"line":1,"column":7},"end":{"line":6,"column":3}},
|
||||
"leadingComments": [
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": "-1",
|
||||
"start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}
|
||||
}
|
||||
],
|
||||
"body": {
|
||||
"type": "SwitchStatement",
|
||||
"start":25,"end":233,"loc":{"start":{"line":1,"column":25},"end":{"line":6,"column":3}},
|
||||
"leadingComments": [
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": "1",
|
||||
"start":19,"end":24,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":24}}
|
||||
}
|
||||
],
|
||||
"innerComments": [
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": "2",
|
||||
"start":32,"end":37,"loc":{"start":{"line":1,"column":32},"end":{"line":1,"column":37}}
|
||||
},
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": "5",
|
||||
"start":60,"end":65,"loc":{"start":{"line":1,"column":60},"end":{"line":1,"column":65}}
|
||||
}
|
||||
],
|
||||
"discriminant": {
|
||||
"type": "BooleanLiteral",
|
||||
"start":46,"end":51,"loc":{"start":{"line":1,"column":46},"end":{"line":1,"column":51}},
|
||||
"leadingComments": [
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": "3",
|
||||
"start":40,"end":45,"loc":{"start":{"line":1,"column":40},"end":{"line":1,"column":45}}
|
||||
}
|
||||
],
|
||||
"trailingComments": [
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": "4",
|
||||
"start":52,"end":57,"loc":{"start":{"line":1,"column":52},"end":{"line":1,"column":57}}
|
||||
}
|
||||
],
|
||||
"value": false
|
||||
},
|
||||
"cases": [
|
||||
{
|
||||
"type": "SwitchCase",
|
||||
"start":78,"end":138,"loc":{"start":{"line":2,"column":10},"end":{"line":3,"column":29}},
|
||||
"leadingComments": [
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": "6",
|
||||
"start":72,"end":77,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":9}}
|
||||
}
|
||||
],
|
||||
"trailingComments": [
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": "12",
|
||||
"start":143,"end":149,"loc":{"start":{"line":4,"column":4},"end":{"line":4,"column":10}}
|
||||
}
|
||||
],
|
||||
"consequent": [
|
||||
{
|
||||
"type": "BreakStatement",
|
||||
"start":113,"end":138,"loc":{"start":{"line":3,"column":4},"end":{"line":3,"column":29}},
|
||||
"leadingComments": [
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": "9",
|
||||
"start":103,"end":108,"loc":{"start":{"line":2,"column":35},"end":{"line":2,"column":40}}
|
||||
}
|
||||
],
|
||||
"label": {
|
||||
"type": "Identifier",
|
||||
"start":126,"end":129,"loc":{"start":{"line":3,"column":17},"end":{"line":3,"column":20},"identifierName":"foo"},
|
||||
"leadingComments": [
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": "10",
|
||||
"start":119,"end":125,"loc":{"start":{"line":3,"column":10},"end":{"line":3,"column":16}}
|
||||
}
|
||||
],
|
||||
"trailingComments": [
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": "11",
|
||||
"start":130,"end":136,"loc":{"start":{"line":3,"column":21},"end":{"line":3,"column":27}}
|
||||
}
|
||||
],
|
||||
"name": "foo"
|
||||
}
|
||||
}
|
||||
],
|
||||
"test": {
|
||||
"type": "BooleanLiteral",
|
||||
"start":89,"end":94,"loc":{"start":{"line":2,"column":21},"end":{"line":2,"column":26}},
|
||||
"leadingComments": [
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": "7",
|
||||
"start":83,"end":88,"loc":{"start":{"line":2,"column":15},"end":{"line":2,"column":20}}
|
||||
}
|
||||
],
|
||||
"trailingComments": [
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": "8",
|
||||
"start":95,"end":100,"loc":{"start":{"line":2,"column":27},"end":{"line":2,"column":32}}
|
||||
}
|
||||
],
|
||||
"value": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "SwitchCase",
|
||||
"start":150,"end":166,"loc":{"start":{"line":4,"column":11},"end":{"line":4,"column":27}},
|
||||
"leadingComments": [
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": "12",
|
||||
"start":143,"end":149,"loc":{"start":{"line":4,"column":4},"end":{"line":4,"column":10}}
|
||||
}
|
||||
],
|
||||
"trailingComments": [
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": "14",
|
||||
"start":167,"end":173,"loc":{"start":{"line":4,"column":28},"end":{"line":4,"column":34}}
|
||||
}
|
||||
],
|
||||
"innerComments": [
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": "13",
|
||||
"start":158,"end":164,"loc":{"start":{"line":4,"column":19},"end":{"line":4,"column":25}}
|
||||
}
|
||||
],
|
||||
"consequent": [],
|
||||
"test": null
|
||||
},
|
||||
{
|
||||
"type": "SwitchCase",
|
||||
"start":178,"end":222,"loc":{"start":{"line":5,"column":4},"end":{"line":5,"column":48}},
|
||||
"leadingComments": [
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": "14",
|
||||
"start":167,"end":173,"loc":{"start":{"line":4,"column":28},"end":{"line":4,"column":34}}
|
||||
}
|
||||
],
|
||||
"trailingComments": [
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": "19",
|
||||
"start":223,"end":229,"loc":{"start":{"line":5,"column":49},"end":{"line":5,"column":55}}
|
||||
}
|
||||
],
|
||||
"consequent": [
|
||||
{
|
||||
"type": "BlockStatement",
|
||||
"start":212,"end":222,"loc":{"start":{"line":5,"column":38},"end":{"line":5,"column":48}},
|
||||
"leadingComments": [
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": "17",
|
||||
"start":205,"end":211,"loc":{"start":{"line":5,"column":31},"end":{"line":5,"column":37}}
|
||||
}
|
||||
],
|
||||
"innerComments": [
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": "18",
|
||||
"start":214,"end":220,"loc":{"start":{"line":5,"column":40},"end":{"line":5,"column":46}}
|
||||
}
|
||||
],
|
||||
"body": [],
|
||||
"directives": []
|
||||
}
|
||||
],
|
||||
"test": {
|
||||
"type": "BooleanLiteral",
|
||||
"start":190,"end":195,"loc":{"start":{"line":5,"column":16},"end":{"line":5,"column":21}},
|
||||
"leadingComments": [
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": "15",
|
||||
"start":183,"end":189,"loc":{"start":{"line":5,"column":9},"end":{"line":5,"column":15}}
|
||||
}
|
||||
],
|
||||
"trailingComments": [
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": "16",
|
||||
"start":196,"end":202,"loc":{"start":{"line":5,"column":22},"end":{"line":5,"column":28}}
|
||||
}
|
||||
],
|
||||
"value": false
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"label": {
|
||||
"type": "Identifier",
|
||||
"start":7,"end":10,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":10},"identifierName":"foo"},
|
||||
"trailingComments": [
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": "0",
|
||||
"start":11,"end":16,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":16}}
|
||||
}
|
||||
],
|
||||
"name": "foo"
|
||||
}
|
||||
}
|
||||
],
|
||||
"directives": []
|
||||
},
|
||||
"comments": [
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": "-1",
|
||||
"start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}
|
||||
},
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": "0",
|
||||
"start":11,"end":16,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":16}}
|
||||
},
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": "1",
|
||||
"start":19,"end":24,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":24}}
|
||||
},
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": "2",
|
||||
"start":32,"end":37,"loc":{"start":{"line":1,"column":32},"end":{"line":1,"column":37}}
|
||||
},
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": "3",
|
||||
"start":40,"end":45,"loc":{"start":{"line":1,"column":40},"end":{"line":1,"column":45}}
|
||||
},
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": "4",
|
||||
"start":52,"end":57,"loc":{"start":{"line":1,"column":52},"end":{"line":1,"column":57}}
|
||||
},
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": "5",
|
||||
"start":60,"end":65,"loc":{"start":{"line":1,"column":60},"end":{"line":1,"column":65}}
|
||||
},
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": "6",
|
||||
"start":72,"end":77,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":9}}
|
||||
},
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": "7",
|
||||
"start":83,"end":88,"loc":{"start":{"line":2,"column":15},"end":{"line":2,"column":20}}
|
||||
},
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": "8",
|
||||
"start":95,"end":100,"loc":{"start":{"line":2,"column":27},"end":{"line":2,"column":32}}
|
||||
},
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": "9",
|
||||
"start":103,"end":108,"loc":{"start":{"line":2,"column":35},"end":{"line":2,"column":40}}
|
||||
},
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": "10",
|
||||
"start":119,"end":125,"loc":{"start":{"line":3,"column":10},"end":{"line":3,"column":16}}
|
||||
},
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": "11",
|
||||
"start":130,"end":136,"loc":{"start":{"line":3,"column":21},"end":{"line":3,"column":27}}
|
||||
},
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": "12",
|
||||
"start":143,"end":149,"loc":{"start":{"line":4,"column":4},"end":{"line":4,"column":10}}
|
||||
},
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": "13",
|
||||
"start":158,"end":164,"loc":{"start":{"line":4,"column":19},"end":{"line":4,"column":25}}
|
||||
},
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": "14",
|
||||
"start":167,"end":173,"loc":{"start":{"line":4,"column":28},"end":{"line":4,"column":34}}
|
||||
},
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": "15",
|
||||
"start":183,"end":189,"loc":{"start":{"line":5,"column":9},"end":{"line":5,"column":15}}
|
||||
},
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": "16",
|
||||
"start":196,"end":202,"loc":{"start":{"line":5,"column":22},"end":{"line":5,"column":28}}
|
||||
},
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": "17",
|
||||
"start":205,"end":211,"loc":{"start":{"line":5,"column":31},"end":{"line":5,"column":37}}
|
||||
},
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": "18",
|
||||
"start":214,"end":220,"loc":{"start":{"line":5,"column":40},"end":{"line":5,"column":46}}
|
||||
},
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": "19",
|
||||
"start":223,"end":229,"loc":{"start":{"line":5,"column":49},"end":{"line":5,"column":55}}
|
||||
}
|
||||
]
|
||||
}
|
||||
1
packages/babel-parser/test/fixtures/comments/basic/switch-no-case-comment/input.js
vendored
Executable file
1
packages/babel-parser/test/fixtures/comments/basic/switch-no-case-comment/input.js
vendored
Executable file
@@ -0,0 +1 @@
|
||||
switch (c)/*1*/ { /*2*/ } /*3*/
|
||||
59
packages/babel-parser/test/fixtures/comments/basic/switch-no-case-comment/output.json
vendored
Normal file
59
packages/babel-parser/test/fixtures/comments/basic/switch-no-case-comment/output.json
vendored
Normal file
@@ -0,0 +1,59 @@
|
||||
{
|
||||
"type": "File",
|
||||
"start":0,"end":31,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":31}},
|
||||
"program": {
|
||||
"type": "Program",
|
||||
"start":0,"end":31,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":31}},
|
||||
"sourceType": "script",
|
||||
"interpreter": null,
|
||||
"body": [
|
||||
{
|
||||
"type": "SwitchStatement",
|
||||
"start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":25}},
|
||||
"trailingComments": [
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": "3",
|
||||
"start":26,"end":31,"loc":{"start":{"line":1,"column":26},"end":{"line":1,"column":31}}
|
||||
}
|
||||
],
|
||||
"innerComments": [
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": "1",
|
||||
"start":10,"end":15,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":15}}
|
||||
},
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": "2",
|
||||
"start":18,"end":23,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":23}}
|
||||
}
|
||||
],
|
||||
"discriminant": {
|
||||
"type": "Identifier",
|
||||
"start":8,"end":9,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":9},"identifierName":"c"},
|
||||
"name": "c"
|
||||
},
|
||||
"cases": []
|
||||
}
|
||||
],
|
||||
"directives": []
|
||||
},
|
||||
"comments": [
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": "1",
|
||||
"start":10,"end":15,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":15}}
|
||||
},
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": "2",
|
||||
"start":18,"end":23,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":23}}
|
||||
},
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": "3",
|
||||
"start":26,"end":31,"loc":{"start":{"line":1,"column":26},"end":{"line":1,"column":31}}
|
||||
}
|
||||
]
|
||||
}
|
||||
4
packages/babel-parser/test/fixtures/comments/basic/try-statement/input.js
vendored
Normal file
4
packages/babel-parser/test/fixtures/comments/basic/try-statement/input.js
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
/*1*/ try /*2*/ {
|
||||
/*3*/ throw /*4*/ "no" /*5*/;
|
||||
/*6*/} /*7*/ catch /*8*/ ( /*9*/ e /*10*/ ) /*11*/ { /*12*/
|
||||
} /*13*/ finally /*14*/ { /*15*/ } /*16*/
|
||||
259
packages/babel-parser/test/fixtures/comments/basic/try-statement/output.json
vendored
Normal file
259
packages/babel-parser/test/fixtures/comments/basic/try-statement/output.json
vendored
Normal file
@@ -0,0 +1,259 @@
|
||||
{
|
||||
"type": "File",
|
||||
"start":0,"end":153,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":41}},
|
||||
"program": {
|
||||
"type": "Program",
|
||||
"start":0,"end":153,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":41}},
|
||||
"sourceType": "script",
|
||||
"interpreter": null,
|
||||
"body": [
|
||||
{
|
||||
"type": "TryStatement",
|
||||
"start":6,"end":146,"loc":{"start":{"line":1,"column":6},"end":{"line":4,"column":34}},
|
||||
"leadingComments": [
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": "1",
|
||||
"start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}
|
||||
}
|
||||
],
|
||||
"trailingComments": [
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": "16",
|
||||
"start":147,"end":153,"loc":{"start":{"line":4,"column":35},"end":{"line":4,"column":41}}
|
||||
}
|
||||
],
|
||||
"block": {
|
||||
"type": "BlockStatement",
|
||||
"start":16,"end":58,"loc":{"start":{"line":1,"column":16},"end":{"line":3,"column":6}},
|
||||
"leadingComments": [
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": "2",
|
||||
"start":10,"end":15,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":15}}
|
||||
}
|
||||
],
|
||||
"trailingComments": [
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": "7",
|
||||
"start":59,"end":64,"loc":{"start":{"line":3,"column":7},"end":{"line":3,"column":12}}
|
||||
}
|
||||
],
|
||||
"body": [
|
||||
{
|
||||
"type": "ThrowStatement",
|
||||
"start":28,"end":51,"loc":{"start":{"line":2,"column":10},"end":{"line":2,"column":33}},
|
||||
"leadingComments": [
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": "3",
|
||||
"start":22,"end":27,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":9}}
|
||||
}
|
||||
],
|
||||
"trailingComments": [
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": "6",
|
||||
"start":52,"end":57,"loc":{"start":{"line":3,"column":0},"end":{"line":3,"column":5}}
|
||||
}
|
||||
],
|
||||
"argument": {
|
||||
"type": "StringLiteral",
|
||||
"start":40,"end":44,"loc":{"start":{"line":2,"column":22},"end":{"line":2,"column":26}},
|
||||
"leadingComments": [
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": "4",
|
||||
"start":34,"end":39,"loc":{"start":{"line":2,"column":16},"end":{"line":2,"column":21}}
|
||||
}
|
||||
],
|
||||
"trailingComments": [
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": "5",
|
||||
"start":45,"end":50,"loc":{"start":{"line":2,"column":27},"end":{"line":2,"column":32}}
|
||||
}
|
||||
],
|
||||
"extra": {
|
||||
"rawValue": "no",
|
||||
"raw": "\"no\""
|
||||
},
|
||||
"value": "no"
|
||||
}
|
||||
}
|
||||
],
|
||||
"directives": []
|
||||
},
|
||||
"handler": {
|
||||
"type": "CatchClause",
|
||||
"start":65,"end":113,"loc":{"start":{"line":3,"column":13},"end":{"line":4,"column":1}},
|
||||
"leadingComments": [
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": "7",
|
||||
"start":59,"end":64,"loc":{"start":{"line":3,"column":7},"end":{"line":3,"column":12}}
|
||||
}
|
||||
],
|
||||
"trailingComments": [
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": "13",
|
||||
"start":114,"end":120,"loc":{"start":{"line":4,"column":2},"end":{"line":4,"column":8}}
|
||||
}
|
||||
],
|
||||
"innerComments": [
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": "8",
|
||||
"start":71,"end":76,"loc":{"start":{"line":3,"column":19},"end":{"line":3,"column":24}}
|
||||
}
|
||||
],
|
||||
"param": {
|
||||
"type": "Identifier",
|
||||
"start":85,"end":86,"loc":{"start":{"line":3,"column":33},"end":{"line":3,"column":34},"identifierName":"e"},
|
||||
"leadingComments": [
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": "9",
|
||||
"start":79,"end":84,"loc":{"start":{"line":3,"column":27},"end":{"line":3,"column":32}}
|
||||
}
|
||||
],
|
||||
"trailingComments": [
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": "10",
|
||||
"start":87,"end":93,"loc":{"start":{"line":3,"column":35},"end":{"line":3,"column":41}}
|
||||
}
|
||||
],
|
||||
"name": "e"
|
||||
},
|
||||
"body": {
|
||||
"type": "BlockStatement",
|
||||
"start":103,"end":113,"loc":{"start":{"line":3,"column":51},"end":{"line":4,"column":1}},
|
||||
"leadingComments": [
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": "11",
|
||||
"start":96,"end":102,"loc":{"start":{"line":3,"column":44},"end":{"line":3,"column":50}}
|
||||
}
|
||||
],
|
||||
"innerComments": [
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": "12",
|
||||
"start":105,"end":111,"loc":{"start":{"line":3,"column":53},"end":{"line":3,"column":59}}
|
||||
}
|
||||
],
|
||||
"body": [],
|
||||
"directives": []
|
||||
}
|
||||
},
|
||||
"finalizer": {
|
||||
"type": "BlockStatement",
|
||||
"start":136,"end":146,"loc":{"start":{"line":4,"column":24},"end":{"line":4,"column":34}},
|
||||
"leadingComments": [
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": "14",
|
||||
"start":129,"end":135,"loc":{"start":{"line":4,"column":17},"end":{"line":4,"column":23}}
|
||||
}
|
||||
],
|
||||
"innerComments": [
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": "15",
|
||||
"start":138,"end":144,"loc":{"start":{"line":4,"column":26},"end":{"line":4,"column":32}}
|
||||
}
|
||||
],
|
||||
"body": [],
|
||||
"directives": []
|
||||
}
|
||||
}
|
||||
],
|
||||
"directives": []
|
||||
},
|
||||
"comments": [
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": "1",
|
||||
"start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}
|
||||
},
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": "2",
|
||||
"start":10,"end":15,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":15}}
|
||||
},
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": "3",
|
||||
"start":22,"end":27,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":9}}
|
||||
},
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": "4",
|
||||
"start":34,"end":39,"loc":{"start":{"line":2,"column":16},"end":{"line":2,"column":21}}
|
||||
},
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": "5",
|
||||
"start":45,"end":50,"loc":{"start":{"line":2,"column":27},"end":{"line":2,"column":32}}
|
||||
},
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": "6",
|
||||
"start":52,"end":57,"loc":{"start":{"line":3,"column":0},"end":{"line":3,"column":5}}
|
||||
},
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": "7",
|
||||
"start":59,"end":64,"loc":{"start":{"line":3,"column":7},"end":{"line":3,"column":12}}
|
||||
},
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": "8",
|
||||
"start":71,"end":76,"loc":{"start":{"line":3,"column":19},"end":{"line":3,"column":24}}
|
||||
},
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": "9",
|
||||
"start":79,"end":84,"loc":{"start":{"line":3,"column":27},"end":{"line":3,"column":32}}
|
||||
},
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": "10",
|
||||
"start":87,"end":93,"loc":{"start":{"line":3,"column":35},"end":{"line":3,"column":41}}
|
||||
},
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": "11",
|
||||
"start":96,"end":102,"loc":{"start":{"line":3,"column":44},"end":{"line":3,"column":50}}
|
||||
},
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": "12",
|
||||
"start":105,"end":111,"loc":{"start":{"line":3,"column":53},"end":{"line":3,"column":59}}
|
||||
},
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": "13",
|
||||
"start":114,"end":120,"loc":{"start":{"line":4,"column":2},"end":{"line":4,"column":8}}
|
||||
},
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": "14",
|
||||
"start":129,"end":135,"loc":{"start":{"line":4,"column":17},"end":{"line":4,"column":23}}
|
||||
},
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": "15",
|
||||
"start":138,"end":144,"loc":{"start":{"line":4,"column":26},"end":{"line":4,"column":32}}
|
||||
},
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": "16",
|
||||
"start":147,"end":153,"loc":{"start":{"line":4,"column":35},"end":{"line":4,"column":41}}
|
||||
}
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user