@@ -7,22 +7,13 @@ use swc_common::{
7
7
sync:: Lrc ,
8
8
BytePos , FileName , SourceMap , Span ,
9
9
} ;
10
- use swc_error_reporters:: {
11
- handler:: { try_with_handler, ThreadSafetyDiagnostics } ,
12
- ErrorEmitter ,
13
- } ;
10
+ use swc_error_reporters:: handler:: try_with_handler;
14
11
15
12
fn output < F > ( file : & str , op : F )
16
13
where
17
14
F : FnOnce ( Lrc < SourceMap > , & Handler ) ,
18
15
{
19
16
let cm = Lrc :: new ( SourceMap :: default ( ) ) ;
20
- let diagnostics = ThreadSafetyDiagnostics :: default ( ) ;
21
- let emitter = ErrorEmitter {
22
- diagnostics : diagnostics. clone ( ) ,
23
- cm : cm. clone ( ) ,
24
- opts : Default :: default ( ) ,
25
- } ;
26
17
27
18
let result = try_with_handler ( cm. clone ( ) , Default :: default ( ) , |handler| -> Result < ( ) , _ > {
28
19
op ( cm. clone ( ) , handler) ;
32
23
33
24
let output = Path :: new ( "tests" ) . join ( "fixture" ) . join ( file) ;
34
25
35
- let errors = diagnostics. as_array ( cm. clone ( ) , Default :: default ( ) ) ;
36
- let pretty_message = errors. to_pretty_string ( ) ;
37
- println ! ( "{}" , pretty_message) ;
38
- fs:: write ( output, & pretty_message) . expect ( "failed to write" ) ;
26
+ let pretty_error = result. to_pretty_string ( ) ;
27
+ println ! ( "{}" , pretty_error) ;
28
+ fs:: write ( output, & pretty_error) . expect ( "failed to write" ) ;
39
29
}
40
30
41
31
fn span ( start : usize , end : usize ) -> Span {
0 commit comments