mirror of
https://github.com/swc-project/swc.git
synced 2024-10-05 12:49:21 +03:00
fix(es/codegen): Fix codegen of classes with minify enabled (#1767)
This commit is contained in:
parent
65ffd87771
commit
5d219b8cd1
@ -7,7 +7,7 @@ include = ["Cargo.toml", "src/**/*.rs"]
|
||||
license = "Apache-2.0/MIT"
|
||||
name = "swc_ecma_codegen"
|
||||
repository = "https://github.com/swc-project/swc.git"
|
||||
version = "0.55.3"
|
||||
version = "0.55.4"
|
||||
|
||||
[dependencies]
|
||||
bitflags = "1"
|
||||
|
@ -37,7 +37,6 @@ impl<'a> Emitter<'a> {
|
||||
space!();
|
||||
emit!(node.ident);
|
||||
emit!(node.class.type_params);
|
||||
formatting_space!();
|
||||
|
||||
self.emit_class_trailing(&node.class)?;
|
||||
}
|
||||
@ -117,6 +116,15 @@ mod tests {
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn issue_1764() {
|
||||
assert_min(
|
||||
"class Hoge {};
|
||||
class HogeFuga extends Hoge {};",
|
||||
"class Hoge{};class HogeFuga extends Hoge{};",
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn single_argument_arrow_expression() {
|
||||
assert_min("function* f(){ yield x => x}", "function*f(){yield x=>x}");
|
||||
|
@ -823,10 +823,6 @@ impl<'a> Emitter<'a> {
|
||||
space!();
|
||||
emit!(i);
|
||||
emit!(node.class.type_params);
|
||||
|
||||
formatting_space!();
|
||||
} else {
|
||||
space!();
|
||||
}
|
||||
|
||||
self.emit_class_trailing(&node.class)?;
|
||||
@ -835,12 +831,13 @@ impl<'a> Emitter<'a> {
|
||||
#[emitter]
|
||||
fn emit_class_trailing(&mut self, node: &Class) -> Result {
|
||||
if node.super_class.is_some() {
|
||||
space!();
|
||||
keyword!("extends");
|
||||
space!();
|
||||
emit!(node.super_class);
|
||||
space!();
|
||||
}
|
||||
|
||||
formatting_space!();
|
||||
punct!("{");
|
||||
self.emit_list(node.span, Some(&node.body), ListFormat::ClassMembers)?;
|
||||
punct!("}");
|
||||
|
Loading…
Reference in New Issue
Block a user