Refactor how spans are combined in the parser.
This commit is contained in:
parent
ec7c0aece1
commit
f08d5ad4c5
22 changed files with 363 additions and 438 deletions
|
@ -12,7 +12,7 @@
|
|||
|
||||
use ast::{self, CrateConfig};
|
||||
use codemap::CodeMap;
|
||||
use syntax_pos::{self, Span, FileMap};
|
||||
use syntax_pos::{self, Span, FileMap, NO_EXPANSION};
|
||||
use errors::{Handler, ColorConfig, DiagnosticBuilder};
|
||||
use feature_gate::UnstableFeatures;
|
||||
use parse::parser::Parser;
|
||||
|
@ -178,7 +178,7 @@ pub fn filemap_to_parser<'a>(sess: &'a ParseSess, filemap: Rc<FileMap>, ) -> Par
|
|||
let mut parser = stream_to_parser(sess, filemap_to_stream(sess, filemap));
|
||||
|
||||
if parser.token == token::Eof && parser.span == syntax_pos::DUMMY_SP {
|
||||
parser.span = syntax_pos::mk_sp(end_pos, end_pos);
|
||||
parser.span = Span { lo: end_pos, hi: end_pos, ctxt: NO_EXPANSION };
|
||||
}
|
||||
|
||||
parser
|
||||
|
@ -665,7 +665,7 @@ mod tests {
|
|||
|
||||
// produce a syntax_pos::span
|
||||
fn sp(a: u32, b: u32) -> Span {
|
||||
Span {lo: BytePos(a), hi: BytePos(b), expn_id: NO_EXPANSION}
|
||||
Span {lo: BytePos(a), hi: BytePos(b), ctxt: NO_EXPANSION}
|
||||
}
|
||||
|
||||
fn str2seg(s: &str, lo: u32, hi: u32) -> ast::PathSegment {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue