Remove token::Lit
from ast::MetaItemLit
.
`token::Lit` contains a `kind` field that indicates what kind of literal it is. `ast::MetaItemLit` currently wraps a `token::Lit` but also has its own `kind` field. This means that `ast::MetaItemLit` encodes the literal kind in two different ways. This commit changes `ast::MetaItemLit` so it no longer wraps `token::Lit`. It now contains the `symbol` and `suffix` fields from `token::Lit`, but not the `kind` field, eliminating the redundancy.
This commit is contained in:
parent
a7f35c42d4
commit
2fd364acff
9 changed files with 56 additions and 23 deletions
|
@ -420,7 +420,7 @@ impl<'a> Parser<'a> {
|
|||
err.span_label(self_.token.span, format!("expected {}", expected));
|
||||
err
|
||||
});
|
||||
PatKind::Lit(self.mk_expr(lo, ExprKind::Lit(lit.token_lit)))
|
||||
PatKind::Lit(self.mk_expr(lo, ExprKind::Lit(lit.as_token_lit())))
|
||||
} else {
|
||||
// Try to parse everything else as literal with optional minus
|
||||
match self.parse_literal_maybe_minus() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue