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