mirror of
https://github.com/swc-project/swc.git
synced 2024-11-23 09:38:16 +03:00
chore(ci): Fix codspeed
benchmark (#9194)
This commit is contained in:
parent
be99ce0a57
commit
e3eb197f00
2
.github/workflows/bench.yml
vendored
2
.github/workflows/bench.yml
vendored
@ -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
|
||||
|
@ -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"
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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<SourceMap>) -> Module {
|
||||
fn module(cm: Lrc<SourceMap>) -> 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<SourceMap>) -> 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<V>(b: &mut Bencher, tr: impl Fn(Mark) -> V)
|
||||
|
Loading…
Reference in New Issue
Block a user