1
Fork 0

Rename parse_const_expr to parse_const_block

This commit is contained in:
Santiago Pastorino 2020-10-20 19:14:17 -03:00
parent 500ddc5efd
commit 954b5a81b4
No known key found for this signature in database
GPG key ID: 8131A24E0C79EFAF
3 changed files with 3 additions and 3 deletions

View file

@ -1063,7 +1063,7 @@ impl<'a> Parser<'a> {
} else if self.eat_keyword(kw::Unsafe) { } else if self.eat_keyword(kw::Unsafe) {
self.parse_block_expr(None, lo, BlockCheckMode::Unsafe(ast::UserProvided), attrs) self.parse_block_expr(None, lo, BlockCheckMode::Unsafe(ast::UserProvided), attrs)
} else if self.check_inline_const() { } else if self.check_inline_const() {
self.parse_const_expr(lo.to(self.token.span)) self.parse_const_block(lo.to(self.token.span))
} else if self.is_do_catch_block() { } else if self.is_do_catch_block() {
self.recover_do_catch(attrs) self.recover_do_catch(attrs)
} else if self.is_try_block() { } else if self.is_try_block() {

View file

@ -864,7 +864,7 @@ impl<'a> Parser<'a> {
} }
/// Parses inline const expressions. /// Parses inline const expressions.
fn parse_const_expr(&mut self, span: Span) -> PResult<'a, P<Expr>> { fn parse_const_block(&mut self, span: Span) -> PResult<'a, P<Expr>> {
self.sess.gated_spans.gate(sym::inline_const, span); self.sess.gated_spans.gate(sym::inline_const, span);
self.eat_keyword(kw::Const); self.eat_keyword(kw::Const);
let blk = self.parse_block()?; let blk = self.parse_block()?;

View file

@ -315,7 +315,7 @@ impl<'a> Parser<'a> {
PatKind::Box(pat) PatKind::Box(pat)
} else if self.check_inline_const() { } else if self.check_inline_const() {
// Parse `const pat` // Parse `const pat`
PatKind::Lit(self.parse_const_expr(lo.to(self.token.span))?) PatKind::Lit(self.parse_const_block(lo.to(self.token.span))?)
} else if self.can_be_ident_pat() { } else if self.can_be_ident_pat() {
// Parse `ident @ pat` // Parse `ident @ pat`
// This can give false positives and parse nullary enums, // This can give false positives and parse nullary enums,