1
Fork 0

libsyntax: De-@mut Parser::last_token

This commit is contained in:
Patrick Walton 2013-12-30 15:30:56 -08:00
parent cc3e6ecbfd
commit 044ad56824

View file

@ -304,7 +304,7 @@ pub fn Parser(sess: @mut ParseSess, cfg: ast::CrateConfig, rdr: @mut reader)
token: tok0.tok, token: tok0.tok,
span: span, span: span,
last_span: span, last_span: span,
last_token: @mut None, last_token: None,
buffer: @mut ([ buffer: @mut ([
placeholder.clone(), placeholder.clone(),
placeholder.clone(), placeholder.clone(),
@ -334,7 +334,7 @@ pub struct Parser {
// the span of the prior token: // the span of the prior token:
last_span: Span, last_span: Span,
// the previous token or None (only stashed sometimes). // the previous token or None (only stashed sometimes).
last_token: @mut Option<~token::Token>, last_token: Option<~token::Token>,
buffer: @mut [TokenAndSpan, ..4], buffer: @mut [TokenAndSpan, ..4],
buffer_start: @mut int, buffer_start: @mut int,
buffer_end: @mut int, buffer_end: @mut int,
@ -728,7 +728,7 @@ impl Parser {
pub fn bump(&mut self) { pub fn bump(&mut self) {
self.last_span = self.span; self.last_span = self.span;
// Stash token for error recovery (sometimes; clone is not necessarily cheap). // Stash token for error recovery (sometimes; clone is not necessarily cheap).
*self.last_token = if is_ident_or_path(&self.token) { self.last_token = if is_ident_or_path(&self.token) {
Some(~self.token.clone()) Some(~self.token.clone())
} else { } else {
None None