1
Fork 0

Pass StableSourceFileId.

This commit is contained in:
Camille GILLOT 2023-09-04 16:02:28 +00:00
parent 4b417c1b8d
commit 3edeac06a5

View file

@ -262,10 +262,9 @@ impl SourceMap {
fn register_source_file( fn register_source_file(
&self, &self,
file_id: StableSourceFileId,
mut file: SourceFile, mut file: SourceFile,
) -> Result<Lrc<SourceFile>, OffsetOverflowError> { ) -> Result<Lrc<SourceFile>, OffsetOverflowError> {
let file_id = StableSourceFileId::new(&file);
let mut files = self.files.borrow_mut(); let mut files = self.files.borrow_mut();
file.start_pos = BytePos(if let Some(last_file) = files.source_files.last() { file.start_pos = BytePos(if let Some(last_file) = files.source_files.last() {
@ -313,7 +312,7 @@ impl SourceMap {
// the ID we generate for the SourceFile we just created. // the ID we generate for the SourceFile we just created.
debug_assert_eq!(StableSourceFileId::new(&source_file), file_id); debug_assert_eq!(StableSourceFileId::new(&source_file), file_id);
self.register_source_file(source_file) self.register_source_file(file_id, source_file)
} }
} }
} }
@ -355,7 +354,8 @@ impl SourceMap {
cnum, cnum,
}; };
self.register_source_file(source_file) let file_id = StableSourceFileId::new(&source_file);
self.register_source_file(file_id, source_file)
.expect("not enough address space for imported source file") .expect("not enough address space for imported source file")
} }