Skip to content

Commit

Permalink
feat(codegen): print type_parameters in TaggedTemplateExpression
Browse files Browse the repository at this point in the history
  • Loading branch information
Dunqing committed Sep 4, 2024
1 parent caf8007 commit a331763
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 0 deletions.
3 changes: 3 additions & 0 deletions crates/oxc_codegen/src/gen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2033,6 +2033,9 @@ impl<'a> Gen for TaggedTemplateExpression<'a> {
fn gen(&self, p: &mut Codegen, ctx: Context) {
p.add_source_mapping(self.span.start);
self.tag.gen_expr(p, Precedence::Postfix, Context::empty());
if let Some(type_parameters) = &self.type_parameters {
type_parameters.gen(p, ctx);
}
self.quasi.gen(p, ctx);
}
}
Expand Down
3 changes: 3 additions & 0 deletions crates/oxc_codegen/tests/integration/snapshots/ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -109,3 +109,6 @@ d = ((x) satisfies y);

export @x declare abstract class C {}
export @x declare abstract class C {}

div<T>``
div<T>``;
1 change: 1 addition & 0 deletions crates/oxc_codegen/tests/integration/ts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ fn ts() {
"c = foo<string>;",
"d = x satisfies y;",
"export @x declare abstract class C {}",
"div<T>``"
];

let snapshot = cases.into_iter().fold(String::new(), |mut w, case| {
Expand Down

0 comments on commit a331763

Please sign in to comment.