Some more minor cleanups

This commit is contained in:
Lukas Wirth 2023-12-02 16:50:21 +01:00
parent 5edf7bddc6
commit 02a3a9438a
7 changed files with 65 additions and 21 deletions

View file

@ -628,14 +628,13 @@ impl ExpansionInfo {
span: SpanData,
// FIXME: use this for range mapping, so that we can resolve inline format args
_relative_token_offset: Option<TextSize>,
// FIXME: ret ty should be wrapped in InMacroFile
) -> Option<impl Iterator<Item = InFile<SyntaxToken>> + 'a> {
) -> Option<impl Iterator<Item = InMacroFile<SyntaxToken>> + 'a> {
let tokens = self
.exp_map
.ranges_with_span(span)
.flat_map(move |range| self.expanded.value.covering_element(range).into_token());
Some(tokens.map(move |token| InFile::new(self.expanded.file_id.into(), token)))
Some(tokens.map(move |token| InMacroFile::new(self.expanded.file_id, token)))
}
/// Maps up the text range out of the expansion hierarchy back into the original file its from.