Fix token::Eof
spans.
This commit is contained in:
parent
f6eaaf350e
commit
a02c18aa52
1 changed files with 6 additions and 2 deletions
|
@ -223,7 +223,7 @@ impl TokenCursor {
|
|||
self.frame = frame;
|
||||
continue
|
||||
} else {
|
||||
return TokenAndSpan { tok: token::Eof, sp: self.frame.span }
|
||||
return TokenAndSpan { tok: token::Eof, sp: syntax_pos::DUMMY_SP }
|
||||
};
|
||||
|
||||
match tree {
|
||||
|
@ -448,10 +448,14 @@ impl<'a> Parser<'a> {
|
|||
}
|
||||
|
||||
fn next_tok(&mut self) -> TokenAndSpan {
|
||||
match self.desugar_doc_comments {
|
||||
let mut next = match self.desugar_doc_comments {
|
||||
true => self.token_cursor.next_desugared(),
|
||||
false => self.token_cursor.next(),
|
||||
};
|
||||
if next.sp == syntax_pos::DUMMY_SP {
|
||||
next.sp = self.prev_span;
|
||||
}
|
||||
next
|
||||
}
|
||||
|
||||
/// Convert a token to a string using self's reader
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue