libsyntax: change Parser::unexpected_last to take &Token
This commit is contained in:
parent
28691a0852
commit
34c02a6c0e
@ -51,12 +51,12 @@ pub fn token_to_str(reader: reader, token: &token::Token) -> ~str {
|
||||
}
|
||||
|
||||
pub impl Parser {
|
||||
fn unexpected_last(t: token::Token) -> ! {
|
||||
fn unexpected_last(t: &token::Token) -> ! {
|
||||
self.span_fatal(
|
||||
*self.last_span,
|
||||
fmt!(
|
||||
"unexpected token: `%s`",
|
||||
token_to_str(self.reader, &t)
|
||||
token_to_str(self.reader, t)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
@ -634,7 +634,7 @@ pub impl Parser {
|
||||
|p| p.parse_ty_field()
|
||||
);
|
||||
if elems.len() == 0 {
|
||||
self.unexpected_last(token::RBRACE);
|
||||
self.unexpected_last(&token::RBRACE);
|
||||
}
|
||||
ty_rec(elems)
|
||||
} else if *self.token == token::LBRACKET {
|
||||
@ -868,7 +868,7 @@ pub impl Parser {
|
||||
lit_float_unsuffixed(self.id_to_str(s)),
|
||||
token::LIT_STR(s) => lit_str(self.id_to_str(s)),
|
||||
token::LPAREN => { self.expect(&token::RPAREN); lit_nil },
|
||||
_ => { self.unexpected_last(*tok); }
|
||||
_ => { self.unexpected_last(tok); }
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user