diff --git a/.github/workflows/bench.yml b/.github/workflows/bench.yml index 1feb2f40a1a..5c3a0d986e2 100644 --- a/.github/workflows/bench.yml +++ b/.github/workflows/bench.yml @@ -101,7 +101,7 @@ jobs: bins: cargo-codspeed - name: Build the benchmark target(s) - run: cargo codspeed build + run: cargo codspeed build --workspace --exclude swc_plugin_runner - name: Run the benchmarks uses: CodSpeedHQ/action@v2 diff --git a/crates/swc_ecma_compat_es2015/src/classes/mod.rs b/crates/swc_ecma_compat_es2015/src/classes/mod.rs index 8a2f36d44cc..4b6d5850af1 100644 --- a/crates/swc_ecma_compat_es2015/src/classes/mod.rs +++ b/crates/swc_ecma_compat_es2015/src/classes/mod.rs @@ -543,29 +543,15 @@ where constructor = Some(c) } } - ClassMember::PrivateMethod(_) => unreachable!( - "classes pass: private method\nclass_properties pass should remove this" - ), ClassMember::Method(m) => methods.push(m), - ClassMember::ClassProp(..) => { - unreachable!("classes pass: property\nclass_properties pass should remove this") - } - ClassMember::PrivateProp(..) => unreachable!( - "classes pass: private property\nclass_properties pass should remove this" - ), - ClassMember::TsIndexSignature(..) => { - // We just strip this. - } + ClassMember::PrivateMethod(_) + | ClassMember::ClassProp(..) + | ClassMember::PrivateProp(..) + | ClassMember::TsIndexSignature(..) + | ClassMember::StaticBlock(..) + | ClassMember::AutoAccessor(..) => {} ClassMember::Empty(..) => {} - ClassMember::StaticBlock(..) => unreachable!( - "classes pass: static blocks\nstatic_blocks pass should remove this" - ), - ClassMember::AutoAccessor(..) => { - unreachable!( - "classes pass: auto accessor \nauto_accesssors pass should remove this" - ) - } } } diff --git a/crates/swc_ecma_transforms_typescript/benches/compat.rs b/crates/swc_ecma_transforms_typescript/benches/compat.rs index ef3dd16a68c..b16230ae6a5 100644 --- a/crates/swc_ecma_transforms_typescript/benches/compat.rs +++ b/crates/swc_ecma_transforms_typescript/benches/compat.rs @@ -1,6 +1,6 @@ use codspeed_criterion_compat::{black_box, criterion_group, criterion_main, Bencher, Criterion}; use swc_common::{chain, comments::SingleThreadedComments, sync::Lrc, FileName, Mark, SourceMap}; -use swc_ecma_ast::Module; +use swc_ecma_ast::{Module, Program}; use swc_ecma_parser::{lexer::Lexer, Parser, StringInput, Syntax}; use swc_ecma_transforms_base::{helpers, resolver}; use swc_ecma_transforms_typescript::strip; @@ -8,7 +8,7 @@ use swc_ecma_visit::{Fold, FoldWith}; static SOURCE: &str = include_str!("assets/AjaxObservable.ts"); -fn module(cm: Lrc) -> Module { +fn module(cm: Lrc) -> Program { let fm = cm.new_source_file(FileName::Anon, SOURCE.into()); let lexer = Lexer::new( Syntax::Typescript(Default::default()), @@ -18,7 +18,11 @@ fn module(cm: Lrc) -> Module { ); let mut parser = Parser::new_from(lexer); - parser.parse_module().map_err(|_| ()).unwrap() + parser + .parse_module() + .map(Program::Module) + .map_err(|_| ()) + .unwrap() } fn run(b: &mut Bencher, tr: impl Fn(Mark) -> V)