Fix missing inner comments in class expressions (#13821)
This commit is contained in:
parent
7acc68a86b
commit
58a65e99c0
@ -31,6 +31,7 @@ export function ClassDeclaration(
|
||||
}
|
||||
|
||||
this.word("class");
|
||||
this.printInnerComments(node);
|
||||
|
||||
if (node.id) {
|
||||
this.space();
|
||||
|
||||
7
packages/babel-generator/test/fixtures/comments/class-comments/input.js
vendored
Normal file
7
packages/babel-generator/test/fixtures/comments/class-comments/input.js
vendored
Normal file
@ -0,0 +1,7 @@
|
||||
const A = class /* before body */ { /* inside body */ };
|
||||
const B = class /* before name */ X /* before body */ { /* inside body */ };
|
||||
const C = class /* before extends */ extends /* after extends */ X /* before body */ {/* inside body */};
|
||||
const D = class /* before name */ X /* before extends */ extends /* after extends */ X /* before body */ {/* inside body */};
|
||||
|
||||
class /* before name */ E /* before body */ { /* inside body */ }
|
||||
class /* before name */ F /* before extends */ extends /* after extends */ X /* before body */ {/* inside body */}
|
||||
3
packages/babel-generator/test/fixtures/comments/class-comments/options.json
vendored
Normal file
3
packages/babel-generator/test/fixtures/comments/class-comments/options.json
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
{
|
||||
"retainLines": true
|
||||
}
|
||||
7
packages/babel-generator/test/fixtures/comments/class-comments/output.js
vendored
Normal file
7
packages/babel-generator/test/fixtures/comments/class-comments/output.js
vendored
Normal file
@ -0,0 +1,7 @@
|
||||
const A = class /* before body */{/* inside body */};
|
||||
const B = class /* before name */X /* before body */ {/* inside body */};
|
||||
const C = class /* before extends */ extends /* after extends */X /* before body */ {/* inside body */};
|
||||
const D = class /* before name */X /* before extends */ extends /* after extends */X /* before body */ {/* inside body */};
|
||||
|
||||
class /* before name */E /* before body */ {/* inside body */}
|
||||
class /* before name */F /* before extends */ extends /* after extends */X /* before body */ {/* inside body */}
|
||||
Loading…
x
Reference in New Issue
Block a user