Skip to content

Commit

Permalink
Fix missing inner comments in class expressions (#13821)
Browse files Browse the repository at this point in the history
  • Loading branch information
overlookmotel committed Oct 6, 2021
1 parent 7acc68a commit 58a65e9
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 0 deletions.
1 change: 1 addition & 0 deletions packages/babel-generator/src/generators/classes.ts
Expand Up @@ -31,6 +31,7 @@ export function ClassDeclaration(
}

this.word("class");
this.printInnerComments(node);

if (node.id) {
this.space();
Expand Down
@@ -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 */}
@@ -0,0 +1,3 @@
{
"retainLines": true
}
@@ -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 */}

0 comments on commit 58a65e9

Please sign in to comment.