diff options
| author | Laurenz <laurmaedje@gmail.com> | 2022-05-25 11:16:03 +0200 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2022-05-25 11:16:03 +0200 |
| commit | 3309ff9fe5ea36134e8ddf11ac2c84613b569856 (patch) | |
| tree | b3eb48d444a5dee7273a76c548a64be96d76f0b9 /src/source.rs | |
| parent | 362a7f2a8ac76f944efa05eabcab0960817777c5 (diff) | |
Slim down context
Diffstat (limited to 'src/source.rs')
| -rw-r--r-- | src/source.rs | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/src/source.rs b/src/source.rs index 7973a2ee..cd5a453a 100644 --- a/src/source.rs +++ b/src/source.rs @@ -59,6 +59,16 @@ impl SourceStore { } } + /// Get a reference to a loaded source file. + /// + /// This panics if no source file with this `id` exists. This function + /// should only be called with ids returned by this store's + /// [`load()`](Self::load) and [`provide()`](Self::provide) methods. + #[track_caller] + pub fn get(&self, id: SourceId) -> &SourceFile { + &self.sources[id.0 as usize] + } + /// Load a source file from a path relative to the compilation environment's /// root. /// @@ -109,14 +119,6 @@ impl SourceStore { id } - /// Get a reference to a loaded source file. - /// - /// This panics if no source file with this `id` exists. - #[track_caller] - pub fn get(&self, id: SourceId) -> &SourceFile { - &self.sources[id.0 as usize] - } - /// Fully [replace](SourceFile::replace) the source text of a file. /// /// This panics if no source file with this `id` exists. |
