From d8d928f0f3db2bc484899928f41e295daa977f23 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B0=95=EB=8F=99=EC=9C=A4=20=28Donny=29?= Date: Thu, 11 Jul 2024 16:33:41 +0900 Subject: [PATCH] Fix more --- crates/swc_bundler/src/bundler/chunk/merge.rs | 3 +-- crates/swc_ecma_minifier/src/compress/optimize/unused.rs | 6 +----- crates/swc_ecma_transforms_typescript/src/strip_type.rs | 1 - crates/swc_estree_compat/src/babelify/decl.rs | 1 - crates/swc_estree_compat/src/babelify/stmt.rs | 1 - 5 files changed, 2 insertions(+), 10 deletions(-) diff --git a/crates/swc_bundler/src/bundler/chunk/merge.rs b/crates/swc_bundler/src/bundler/chunk/merge.rs index 643dfc42e58d..5eedbe9be599 100644 --- a/crates/swc_bundler/src/bundler/chunk/merge.rs +++ b/crates/swc_bundler/src/bundler/chunk/merge.rs @@ -917,8 +917,7 @@ where | Decl::TsTypeAlias(_) | Decl::TsEnum(_) | Decl::TsModule(_) - | Decl::Using(..) - | Decl::Invalid(..) => continue, + | Decl::Using(..) => continue, }; tracing::trace!( diff --git a/crates/swc_ecma_minifier/src/compress/optimize/unused.rs b/crates/swc_ecma_minifier/src/compress/optimize/unused.rs index ade710aea55e..b7f01caf5d45 100644 --- a/crates/swc_ecma_minifier/src/compress/optimize/unused.rs +++ b/crates/swc_ecma_minifier/src/compress/optimize/unused.rs @@ -549,11 +549,7 @@ impl Optimizer<'_> { // TODO: Optimize } - Decl::TsInterface(_) - | Decl::TsTypeAlias(_) - | Decl::TsEnum(_) - | Decl::TsModule(_) - | Decl::Invalid(..) => { + Decl::TsInterface(_) | Decl::TsTypeAlias(_) | Decl::TsEnum(_) | Decl::TsModule(_) => { // Nothing to do. We might change this to unreachable!() } } diff --git a/crates/swc_ecma_transforms_typescript/src/strip_type.rs b/crates/swc_ecma_transforms_typescript/src/strip_type.rs index 69fd8e6b5229..c88cad3b85b3 100644 --- a/crates/swc_ecma_transforms_typescript/src/strip_type.rs +++ b/crates/swc_ecma_transforms_typescript/src/strip_type.rs @@ -341,7 +341,6 @@ impl IsDeclare for Decl { Decl::TsInterface(_) | Decl::TsTypeAlias(_) => true, Decl::TsEnum(ts_enum) => ts_enum.declare, Decl::TsModule(ts_module) => ts_module.declare || ts_module.global, - Decl::Invalid(..) => false, } } } diff --git a/crates/swc_estree_compat/src/babelify/decl.rs b/crates/swc_estree_compat/src/babelify/decl.rs index 6cbfcd71501e..656f9b0e77c3 100644 --- a/crates/swc_estree_compat/src/babelify/decl.rs +++ b/crates/swc_estree_compat/src/babelify/decl.rs @@ -20,7 +20,6 @@ impl Babelify for Decl { Decl::TsTypeAlias(d) => Declaration::TSTypeAliasDecl(d.babelify(ctx)), Decl::TsEnum(d) => Declaration::TSEnumDecl(d.babelify(ctx)), Decl::TsModule(d) => Declaration::TSModuleDecl(d.babelify(ctx)), - Decl::Invalid(..) => unreachable!(), } } } diff --git a/crates/swc_estree_compat/src/babelify/stmt.rs b/crates/swc_estree_compat/src/babelify/stmt.rs index 6ce47e19e171..0f8d08538066 100644 --- a/crates/swc_estree_compat/src/babelify/stmt.rs +++ b/crates/swc_estree_compat/src/babelify/stmt.rs @@ -61,7 +61,6 @@ impl Babelify for Stmt { Decl::TsTypeAlias(d) => Statement::TSTypeAliasDecl(d.babelify(ctx)), Decl::TsEnum(d) => Statement::TSEnumDecl(d.babelify(ctx)), Decl::TsModule(d) => Statement::TSModuleDecl(d.babelify(ctx)), - Decl::Invalid(..) => unreachable!(), }, Stmt::Expr(s) => Statement::Expr(s.babelify(ctx)), }