@@ -11,6 +11,7 @@ use crate::{
1111 stream_and_get_source_and_map, stream_chunks_of_raw_source,
1212 stream_chunks_of_source_map, StreamChunks ,
1313 } ,
14+ object_pool:: ObjectPool ,
1415 rope:: Rope ,
1516 source:: SourceValue ,
1617 BoxSource , MapOptions , Source , SourceExt , SourceMap ,
@@ -99,18 +100,22 @@ impl Source for CachedSource {
99100 * self . cache . size . get_or_init ( || self . inner . size ( ) )
100101 }
101102
102- fn map ( & self , options : & MapOptions ) -> Option < SourceMap > {
103+ fn map (
104+ & self ,
105+ object_pool : & ObjectPool ,
106+ options : & MapOptions ,
107+ ) -> Option < SourceMap > {
103108 if options. columns {
104109 self
105110 . cache
106111 . columns_map
107- . get_or_init ( || self . inner . map ( options) )
112+ . get_or_init ( || self . inner . map ( object_pool , options) )
108113 . clone ( )
109114 } else {
110115 self
111116 . cache
112117 . line_only_map
113- . get_or_init ( || self . inner . map ( options) )
118+ . get_or_init ( || self . inner . map ( object_pool , options) )
114119 . clone ( )
115120 }
116121 }
@@ -123,6 +128,7 @@ impl Source for CachedSource {
123128impl StreamChunks for CachedSource {
124129 fn stream_chunks < ' a > (
125130 & ' a self ,
131+ object_pool : & ' a ObjectPool ,
126132 options : & MapOptions ,
127133 on_chunk : crate :: helpers:: OnChunk < ' _ , ' a > ,
128134 on_source : crate :: helpers:: OnSource < ' _ , ' a > ,
@@ -138,7 +144,13 @@ impl StreamChunks for CachedSource {
138144 let source = self . rope ( ) ;
139145 if let Some ( map) = map {
140146 stream_chunks_of_source_map (
141- source, map, on_chunk, on_source, on_name, options,
147+ options,
148+ object_pool,
149+ source,
150+ map,
151+ on_chunk,
152+ on_source,
153+ on_name,
142154 )
143155 } else {
144156 stream_chunks_of_raw_source (
@@ -148,8 +160,9 @@ impl StreamChunks for CachedSource {
148160 }
149161 None => {
150162 let ( generated_info, map) = stream_and_get_source_and_map (
151- & self . inner ,
152163 options,
164+ object_pool,
165+ & self . inner ,
153166 on_chunk,
154167 on_source,
155168 on_name,
@@ -233,7 +246,9 @@ mod tests {
233246 } )
234247 . boxed ( ) ,
235248 ] ) ;
236- let map = source. map ( & Default :: default ( ) ) . unwrap ( ) ;
249+ let map = source
250+ . map ( & ObjectPool :: default ( ) , & Default :: default ( ) )
251+ . unwrap ( ) ;
237252 assert_eq ! ( map. mappings( ) , ";;AACA" ) ;
238253 }
239254
@@ -248,11 +263,11 @@ mod tests {
248263 source. source ( ) ;
249264 source. buffer ( ) ;
250265 source. size ( ) ;
251- source. map ( & map_options) ;
266+ source. map ( & ObjectPool :: default ( ) , & map_options) ;
252267
253268 assert_eq ! (
254269 * clone. cache. columns_map. get( ) . unwrap( ) ,
255- source. map( & map_options)
270+ source. map( & ObjectPool :: default ( ) , & map_options)
256271 ) ;
257272 }
258273
@@ -302,16 +317,14 @@ mod tests {
302317
303318 #[ test]
304319 fn should_produce_correct_output_for_cached_raw_source ( ) {
305- let map_options = MapOptions {
306- columns : true ,
307- final_source : true ,
308- } ;
320+ let map_options = MapOptions :: new ( true ) ;
309321
310322 let source = RawStringSource :: from ( "Test\n Test\n Test\n " ) ;
311323 let mut on_chunk_count = 0 ;
312324 let mut on_source_count = 0 ;
313325 let mut on_name_count = 0 ;
314326 let generated_info = source. stream_chunks (
327+ & ObjectPool :: default ( ) ,
315328 & map_options,
316329 & mut |_chunk, _mapping| {
317330 on_chunk_count += 1 ;
@@ -326,6 +339,7 @@ mod tests {
326339
327340 let cached_source = CachedSource :: new ( source) ;
328341 cached_source. stream_chunks (
342+ & ObjectPool :: default ( ) ,
329343 & map_options,
330344 & mut |_chunk, _mapping| { } ,
331345 & mut |_source_index, _source, _source_content| { } ,
@@ -336,6 +350,7 @@ mod tests {
336350 let mut cached_on_source_count = 0 ;
337351 let mut cached_on_name_count = 0 ;
338352 let cached_generated_info = cached_source. stream_chunks (
353+ & ObjectPool :: default ( ) ,
339354 & map_options,
340355 & mut |_chunk, _mapping| {
341356 cached_on_chunk_count += 1 ;
0 commit comments