diff options
| author | Mikko Rantanen <jubjub@jubjubnest.net> | 2019-10-03 03:55:31 +0300 |
|---|---|---|
| committer | Mikko Rantanen <jubjub@jubjubnest.net> | 2019-10-21 19:28:29 +0300 |
| commit | ff1860ad763baac652d3a43a93985e29ade805cb (patch) | |
| tree | 4c425dd8c70519e74aa630405d35019e234ee591 /src/libsyntax/source_map.rs | |
| parent | 2748a9fd93dd1a00a4521f4f16de5befbf77f6cd (diff) | |
| download | rust-ff1860ad763baac652d3a43a93985e29ade805cb.tar.gz rust-ff1860ad763baac652d3a43a93985e29ade805cb.zip | |
Fix the start/end byte positions in the compiler JSON output
Diffstat (limited to 'src/libsyntax/source_map.rs')
| -rw-r--r-- | src/libsyntax/source_map.rs | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/libsyntax/source_map.rs b/src/libsyntax/source_map.rs index 7d0d2392945..359b5957167 100644 --- a/src/libsyntax/source_map.rs +++ b/src/libsyntax/source_map.rs @@ -283,6 +283,7 @@ impl SourceMap { mut file_local_lines: Vec<BytePos>, mut file_local_multibyte_chars: Vec<MultiByteChar>, mut file_local_non_narrow_chars: Vec<NonNarrowChar>, + mut file_local_normalized_pos: Vec<NormalizedPos>, ) -> Lrc<SourceFile> { let start_pos = self.next_start_pos(); @@ -301,6 +302,10 @@ impl SourceMap { *swc = *swc + start_pos; } + for nc in &mut file_local_normalized_pos { + nc.pos = nc.pos + start_pos; + } + let source_file = Lrc::new(SourceFile { name: filename, name_was_remapped, @@ -314,6 +319,7 @@ impl SourceMap { lines: file_local_lines, multibyte_chars: file_local_multibyte_chars, non_narrow_chars: file_local_non_narrow_chars, + normalized_pos: file_local_normalized_pos, name_hash, }); |
