From d6dcbcd4e11a1b787a9db1fa43a49907e8bccecf Mon Sep 17 00:00:00 2001 From: Donato Sciarra Date: Sat, 18 Aug 2018 12:13:52 +0200 Subject: mv FileMap SourceFile --- src/libsyntax/parse/lexer/mod.rs | 10 +++++----- src/libsyntax/parse/mod.rs | 8 ++++---- 2 files changed, 9 insertions(+), 9 deletions(-) (limited to 'src/libsyntax/parse') diff --git a/src/libsyntax/parse/lexer/mod.rs b/src/libsyntax/parse/lexer/mod.rs index c1919434e37..654ac692338 100644 --- a/src/libsyntax/parse/lexer/mod.rs +++ b/src/libsyntax/parse/lexer/mod.rs @@ -49,7 +49,7 @@ pub struct StringReader<'a> { pub pos: BytePos, /// The current character (which has been read from self.pos) pub ch: Option, - pub filemap: Lrc, + pub filemap: Lrc, /// Stop reading src at this index. pub end_src_index: usize, // cached: @@ -180,7 +180,7 @@ impl<'a> StringReader<'a> { } /// For comments.rs, which hackily pokes into next_pos and ch - fn new_raw(sess: &'a ParseSess, filemap: Lrc, override_span: Option) + fn new_raw(sess: &'a ParseSess, filemap: Lrc, override_span: Option) -> Self { let mut sr = StringReader::new_raw_internal(sess, filemap, override_span); @@ -189,7 +189,7 @@ impl<'a> StringReader<'a> { sr } - fn new_raw_internal(sess: &'a ParseSess, filemap: Lrc, + fn new_raw_internal(sess: &'a ParseSess, filemap: Lrc, override_span: Option) -> Self { if filemap.src.is_none() { @@ -221,7 +221,7 @@ impl<'a> StringReader<'a> { } } - pub fn new(sess: &'a ParseSess, filemap: Lrc, override_span: Option) + pub fn new(sess: &'a ParseSess, filemap: Lrc, override_span: Option) -> Self { let mut sr = StringReader::new_raw(sess, filemap, override_span); @@ -468,7 +468,7 @@ impl<'a> StringReader<'a> { } /// Advance the StringReader by one character. If a newline is - /// discovered, add it to the FileMap's list of line start offsets. + /// discovered, add it to the SourceFile's list of line start offsets. crate fn bump(&mut self) { let next_src_index = self.src_index(self.next_pos); if next_src_index < self.end_src_index { diff --git a/src/libsyntax/parse/mod.rs b/src/libsyntax/parse/mod.rs index d43cbf38064..65bab94c6bc 100644 --- a/src/libsyntax/parse/mod.rs +++ b/src/libsyntax/parse/mod.rs @@ -14,7 +14,7 @@ use rustc_data_structures::sync::{Lrc, Lock}; use ast::{self, CrateConfig, NodeId}; use early_buffered_lints::{BufferedEarlyLint, BufferedEarlyLintId}; use codemap::{SourceMap, FilePathMapping}; -use syntax_pos::{Span, FileMap, FileName, MultiSpan}; +use syntax_pos::{Span, SourceFile, FileName, MultiSpan}; use errors::{Handler, ColorConfig, DiagnosticBuilder}; use feature_gate::UnstableFeatures; use parse::parser::Parser; @@ -203,7 +203,7 @@ crate fn new_sub_parser_from_file<'a>(sess: &'a ParseSess, } /// Given a filemap and config, return a parser -fn filemap_to_parser(sess: & ParseSess, filemap: Lrc) -> Parser { +fn filemap_to_parser(sess: & ParseSess, filemap: Lrc) -> Parser { let end_pos = filemap.end_pos; let mut parser = stream_to_parser(sess, filemap_to_stream(sess, filemap, None)); @@ -226,7 +226,7 @@ pub fn new_parser_from_tts(sess: &ParseSess, tts: Vec) -> Parser { /// Given a session and a path and an optional span (for error reporting), /// add the path to the session's codemap and return the new filemap. fn file_to_filemap(sess: &ParseSess, path: &Path, spanopt: Option) - -> Lrc { + -> Lrc { match sess.codemap().load_file(path) { Ok(filemap) => filemap, Err(e) => { @@ -240,7 +240,7 @@ fn file_to_filemap(sess: &ParseSess, path: &Path, spanopt: Option) } /// Given a filemap, produce a sequence of token-trees -pub fn filemap_to_stream(sess: &ParseSess, filemap: Lrc, override_span: Option) +pub fn filemap_to_stream(sess: &ParseSess, filemap: Lrc, override_span: Option) -> TokenStream { let mut srdr = lexer::StringReader::new(sess, filemap, override_span); srdr.real_token(); -- cgit 1.4.1-3-g733a5