Turn ast::Lit
into a struct
This commit is contained in:
parent
b8e0d0a2aa
commit
28b125b83d
5 changed files with 24 additions and 17 deletions
|
@ -2140,15 +2140,14 @@ impl<'a> Parser<'a> {
|
|||
/// Matches `lit = true | false | token_lit`.
|
||||
crate fn parse_lit(&mut self) -> PResult<'a, Lit> {
|
||||
let lo = self.span;
|
||||
let lit = if self.eat_keyword(keywords::True) {
|
||||
let node = if self.eat_keyword(keywords::True) {
|
||||
LitKind::Bool(true)
|
||||
} else if self.eat_keyword(keywords::False) {
|
||||
LitKind::Bool(false)
|
||||
} else {
|
||||
let lit = self.parse_lit_token()?;
|
||||
lit
|
||||
self.parse_lit_token()?
|
||||
};
|
||||
Ok(source_map::Spanned { node: lit, span: lo.to(self.prev_span) })
|
||||
Ok(Lit { node, span: lo.to(self.prev_span) })
|
||||
}
|
||||
|
||||
/// Matches `'-' lit | lit` (cf. `ast_validation::AstValidator::check_expr_within_pat`).
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue