1
Fork 0

Encode index of SourceFile along with span.

This commit is contained in:
Camille GILLOT 2022-08-06 22:33:06 +02:00
parent 55f46419af
commit f20ceb1c6f
5 changed files with 65 additions and 69 deletions

View file

@ -1098,6 +1098,8 @@ pub enum ExternalSource {
original_start_pos: BytePos,
/// The end of this SourceFile within the source_map of its original crate.
original_end_pos: BytePos,
/// Index of the file inside metadata.
metadata_index: u32,
},
}

View file

@ -337,6 +337,7 @@ impl SourceMap {
mut file_local_normalized_pos: Vec<NormalizedPos>,
original_start_pos: BytePos,
original_end_pos: BytePos,
metadata_index: u32,
) -> Lrc<SourceFile> {
let start_pos = self
.allocate_address_space(source_len)
@ -383,6 +384,7 @@ impl SourceMap {
kind: ExternalSourceKind::AbsentOk,
original_start_pos,
original_end_pos,
metadata_index,
}),
start_pos,
end_pos,

View file

@ -252,6 +252,7 @@ fn t10() {
normalized_pos,
start_pos,
end_pos,
0,
);
assert!(