Skip to content

Commit

Permalink
fix(es/codegen): Print the missing abstract in class expression (#9372
Browse files Browse the repository at this point in the history
)

- Closes #9370
  • Loading branch information
magic-akari authored Aug 4, 2024
1 parent 21ed716 commit c2e3021
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/modern-bears-flash.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
swc_ecma_codegen: patch
---

fix(es/codegen): Print the missing `abstract` in class expression
5 changes: 5 additions & 0 deletions crates/swc_ecma_codegen/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1342,6 +1342,11 @@ where
emit!(dec);
}

if node.class.is_abstract {
keyword!("abstract");
space!();
}

keyword!("class");

if let Some(ref i) = node.ident {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
export default abstract class Predictor {
abstract _type: string;
}

export abstract class Foo {
abstract _type: string;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
export default abstract class Predictor {
abstract _type: string;
}
export abstract class Foo {
abstract _type: string;
}

0 comments on commit c2e3021

Please sign in to comment.