Rename maybe_file_to_stream as maybe_source_file_to_stream.

Because it takes an `Lrc<SourceFile>`, and for consistency with
`source_file_to_stream`.
This commit is contained in:
Nicholas Nethercote 2024-05-31 11:01:23 +10:00
parent f6576249ab
commit 769ca3f661

View File

@ -122,7 +122,7 @@ fn maybe_source_file_to_parser(
source_file: Lrc<SourceFile>, source_file: Lrc<SourceFile>,
) -> Result<Parser<'_>, Vec<Diag<'_>>> { ) -> Result<Parser<'_>, Vec<Diag<'_>>> {
let end_pos = source_file.end_position(); let end_pos = source_file.end_position();
let stream = maybe_file_to_stream(psess, source_file, None)?; let stream = maybe_source_file_to_stream(psess, source_file, None)?;
let mut parser = stream_to_parser(psess, stream, None); let mut parser = stream_to_parser(psess, stream, None);
if parser.token == token::Eof { if parser.token == token::Eof {
parser.token.span = Span::new(end_pos, end_pos, parser.token.span.ctxt(), None); parser.token.span = Span::new(end_pos, end_pos, parser.token.span.ctxt(), None);
@ -148,12 +148,12 @@ pub fn source_file_to_stream(
source_file: Lrc<SourceFile>, source_file: Lrc<SourceFile>,
override_span: Option<Span>, override_span: Option<Span>,
) -> TokenStream { ) -> TokenStream {
panictry_buffer!(maybe_file_to_stream(psess, source_file, override_span)) panictry_buffer!(maybe_source_file_to_stream(psess, source_file, override_span))
} }
/// Given a source file, produces a sequence of token trees. Returns any buffered errors from /// Given a source file, produces a sequence of token trees. Returns any buffered errors from
/// parsing the token stream. /// parsing the token stream.
fn maybe_file_to_stream<'psess>( fn maybe_source_file_to_stream<'psess>(
psess: &'psess ParseSess, psess: &'psess ParseSess,
source_file: Lrc<SourceFile>, source_file: Lrc<SourceFile>,
override_span: Option<Span>, override_span: Option<Span>,