@@ -19,23 +19,6 @@ pub trait SourceMapGetter {
19
19
) -> Option < String > ;
20
20
}
21
21
22
- impl < T > SourceMapGetter for Rc < T >
23
- where
24
- T : SourceMapGetter + ?Sized ,
25
- {
26
- fn get_source_map ( & self , file_name : & str ) -> Option < Vec < u8 > > {
27
- ( * * self ) . get_source_map ( file_name)
28
- }
29
-
30
- fn get_source_line (
31
- & self ,
32
- file_name : & str ,
33
- line_number : usize ,
34
- ) -> Option < String > {
35
- ( * * self ) . get_source_line ( file_name, line_number)
36
- }
37
- }
38
-
39
22
pub enum SourceMapApplication {
40
23
/// No mapping was applied, the location is unchanged.
41
24
Unchanged ,
@@ -54,18 +37,18 @@ pub enum SourceMapApplication {
54
37
55
38
pub type SourceMapData = Cow < ' static , [ u8 ] > ;
56
39
57
- pub struct SourceMapper < G : SourceMapGetter > {
40
+ pub struct SourceMapper {
58
41
maps : HashMap < String , Option < SourceMap > > ,
59
42
source_lines : HashMap < ( String , i64 ) , Option < String > > ,
60
- getter : Option < G > ,
43
+ getter : Option < Rc < dyn SourceMapGetter > > ,
61
44
pub ( crate ) ext_source_maps : HashMap < String , SourceMapData > ,
62
45
// This is not the right place for this, but it's the easiest way to make
63
46
// op_apply_source_map a fast op. This stashing should happen in #[op2].
64
47
pub ( crate ) stashed_file_name : Option < String > ,
65
48
}
66
49
67
- impl < G : SourceMapGetter > SourceMapper < G > {
68
- pub fn new ( getter : Option < G > ) -> Self {
50
+ impl SourceMapper {
51
+ pub fn new ( getter : Option < Rc < dyn SourceMapGetter > > ) -> Self {
69
52
Self {
70
53
maps : Default :: default ( ) ,
71
54
source_lines : Default :: default ( ) ,
@@ -75,7 +58,7 @@ impl<G: SourceMapGetter> SourceMapper<G> {
75
58
}
76
59
}
77
60
78
- pub fn has_user_sources ( & self ) -> bool {
61
+ pub ( crate ) fn has_user_sources ( & self ) -> bool {
79
62
self . getter . is_some ( )
80
63
}
81
64
0 commit comments