diff options
Diffstat (limited to 'src/libsyntax/parse')
| -rw-r--r-- | src/libsyntax/parse/lexer/mod.rs | 10 | ||||
| -rw-r--r-- | src/libsyntax/parse/mod.rs | 8 |
2 files changed, 9 insertions, 9 deletions
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<char>, - pub filemap: Lrc<syntax_pos::FileMap>, + pub filemap: Lrc<syntax_pos::SourceFile>, /// 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<syntax_pos::FileMap>, override_span: Option<Span>) + fn new_raw(sess: &'a ParseSess, filemap: Lrc<syntax_pos::SourceFile>, override_span: Option<Span>) -> 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<syntax_pos::FileMap>, + fn new_raw_internal(sess: &'a ParseSess, filemap: Lrc<syntax_pos::SourceFile>, override_span: Option<Span>) -> Self { if filemap.src.is_none() { @@ -221,7 +221,7 @@ impl<'a> StringReader<'a> { } } - pub fn new(sess: &'a ParseSess, filemap: Lrc<syntax_pos::FileMap>, override_span: Option<Span>) + pub fn new(sess: &'a ParseSess, filemap: Lrc<syntax_pos::SourceFile>, override_span: Option<Span>) -> 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<FileMap>) -> Parser { +fn filemap_to_parser(sess: & ParseSess, filemap: Lrc<SourceFile>) -> 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<TokenTree>) -> 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<Span>) - -> Lrc<FileMap> { + -> Lrc<SourceFile> { 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<Span>) } /// Given a filemap, produce a sequence of token-trees -pub fn filemap_to_stream(sess: &ParseSess, filemap: Lrc<FileMap>, override_span: Option<Span>) +pub fn filemap_to_stream(sess: &ParseSess, filemap: Lrc<SourceFile>, override_span: Option<Span>) -> TokenStream { let mut srdr = lexer::StringReader::new(sess, filemap, override_span); srdr.real_token(); |
