@@ -596,8 +596,8 @@ impl CodeMap {
596
596
pub fn new_imported_filemap ( & self ,
597
597
filename : FileName ,
598
598
source_len : usize ,
599
- file_local_lines : Vec < BytePos > ,
600
- file_local_multibyte_chars : Vec < MultiByteChar > )
599
+ mut file_local_lines : Vec < BytePos > ,
600
+ mut file_local_multibyte_chars : Vec < MultiByteChar > )
601
601
-> Rc < FileMap > {
602
602
let mut files = self . files . borrow_mut ( ) ;
603
603
let start_pos = match files. last ( ) {
@@ -608,19 +608,21 @@ impl CodeMap {
608
608
let end_pos = Pos :: from_usize ( start_pos + source_len) ;
609
609
let start_pos = Pos :: from_usize ( start_pos) ;
610
610
611
- let lines = file_local_lines. map_in_place ( |pos| pos + start_pos) ;
612
- let multibyte_chars = file_local_multibyte_chars. map_in_place ( |mbc| MultiByteChar {
613
- pos : mbc. pos + start_pos,
614
- bytes : mbc. bytes
615
- } ) ;
611
+ for pos in & mut file_local_lines {
612
+ * pos = * pos + start_pos;
613
+ }
614
+
615
+ for mbc in & mut file_local_multibyte_chars {
616
+ mbc. pos = mbc. pos + start_pos;
617
+ }
616
618
617
619
let filemap = Rc :: new ( FileMap {
618
620
name : filename,
619
621
src : None ,
620
622
start_pos : start_pos,
621
623
end_pos : end_pos,
622
- lines : RefCell :: new ( lines ) ,
623
- multibyte_chars : RefCell :: new ( multibyte_chars ) ,
624
+ lines : RefCell :: new ( file_local_lines ) ,
625
+ multibyte_chars : RefCell :: new ( file_local_multibyte_chars ) ,
624
626
} ) ;
625
627
626
628
files. push ( filemap. clone ( ) ) ;
0 commit comments