From 2dc44cb692aa086e4726e9ee2390e320b9bebfa7 Mon Sep 17 00:00:00 2001 From: shaodahong Date: Tue, 9 Jun 2020 23:06:57 +0800 Subject: [PATCH] add test file --- .../comments/regression/11469/input.js | 7 ++ .../comments/regression/11469/output.json | 77 +++++++++++++++++++ 2 files changed, 84 insertions(+) create mode 100644 packages/babel-parser/test/fixtures/comments/regression/11469/input.js create mode 100644 packages/babel-parser/test/fixtures/comments/regression/11469/output.json diff --git a/packages/babel-parser/test/fixtures/comments/regression/11469/input.js b/packages/babel-parser/test/fixtures/comments/regression/11469/input.js new file mode 100644 index 000000000000..fe81aa8d481e --- /dev/null +++ b/packages/babel-parser/test/fixtures/comments/regression/11469/input.js @@ -0,0 +1,7 @@ +class A { + test() { + // this.member = 'value'; + } + + /* Trailing comment */ +} diff --git a/packages/babel-parser/test/fixtures/comments/regression/11469/output.json b/packages/babel-parser/test/fixtures/comments/regression/11469/output.json new file mode 100644 index 000000000000..a44446676761 --- /dev/null +++ b/packages/babel-parser/test/fixtures/comments/regression/11469/output.json @@ -0,0 +1,77 @@ +{ + "type": "File", + "start":0,"end":82,"loc":{"start":{"line":1,"column":0},"end":{"line":7,"column":1}}, + "program": { + "type": "Program", + "start":0,"end":82,"loc":{"start":{"line":1,"column":0},"end":{"line":7,"column":1}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start":0,"end":82,"loc":{"start":{"line":1,"column":0},"end":{"line":7,"column":1}}, + "id": { + "type": "Identifier", + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"A"}, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start":8,"end":82,"loc":{"start":{"line":1,"column":8},"end":{"line":7,"column":1}}, + "body": [ + { + "type": "ClassMethod", + "start":12,"end":54,"loc":{"start":{"line":2,"column":2},"end":{"line":4,"column":3}}, + "static": false, + "key": { + "type": "Identifier", + "start":12,"end":16,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":6},"identifierName":"test"}, + "name": "test" + }, + "computed": false, + "kind": "method", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":19,"end":54,"loc":{"start":{"line":2,"column":9},"end":{"line":4,"column":3}}, + "body": [], + "directives": [], + "innerComments": [ + { + "type": "CommentLine", + "value": " this.member = 'value';", + "start":25,"end":50,"loc":{"start":{"line":3,"column":4},"end":{"line":3,"column":29}} + } + ] + }, + "trailingComments": [ + { + "type": "CommentBlock", + "value": " Trailing comment ", + "start":58,"end":80,"loc":{"start":{"line":6,"column":2},"end":{"line":6,"column":24}} + } + ] + } + ] + } + } + ], + "directives": [] + }, + "comments": [ + { + "type": "CommentLine", + "value": " this.member = 'value';", + "start":25,"end":50,"loc":{"start":{"line":3,"column":4},"end":{"line":3,"column":29}} + }, + { + "type": "CommentBlock", + "value": " Trailing comment ", + "start":58,"end":80,"loc":{"start":{"line":6,"column":2},"end":{"line":6,"column":24}} + } + ] +} \ No newline at end of file