Skip to content

Commit

Permalink
parser: is_fn_front_matter -> check_fn_front_matter
Browse files Browse the repository at this point in the history
  • Loading branch information
Centril committed Feb 13, 2020
1 parent 4ca3bbf commit 9828559
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/librustc_parse/parser/item.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ impl<'a> Parser<'a> {
return Ok(Some(item));
}

if self.is_fn_front_matter() {
if self.check_fn_front_matter() {
// FUNCTION ITEM
let (ident, sig, generics, body) = self.parse_fn(&mut false, &mut attrs, |_| true)?;
let kind = ItemKind::Fn(sig, generics, body);
Expand Down Expand Up @@ -742,7 +742,7 @@ impl<'a> Parser<'a> {
let defaultness = self.parse_defaultness();
let (name, kind, generics) = if self.eat_keyword(kw::Type) {
self.parse_assoc_ty()?
} else if self.is_fn_front_matter() {
} else if self.check_fn_front_matter() {
let (ident, sig, generics, body) = self.parse_fn(at_end, &mut attrs, req_name)?;
(ident, AssocItemKind::Fn(sig, body), generics)
} else if let Some(mac) = self.parse_assoc_macro_invoc("associated", Some(&vis), at_end)? {
Expand Down Expand Up @@ -978,7 +978,7 @@ impl<'a> Parser<'a> {
if self.check_keyword(kw::Type) {
// FOREIGN TYPE ITEM
self.parse_item_foreign_type(vis, lo, attrs)
} else if self.is_fn_front_matter() {
} else if self.check_fn_front_matter() {
// FOREIGN FUNCTION ITEM
let (ident, sig, generics, body) = self.parse_fn(&mut false, &mut attrs, |_| true)?;
let kind = ForeignItemKind::Fn(sig, generics, body);
Expand Down Expand Up @@ -1658,7 +1658,7 @@ impl<'a> Parser<'a> {
}

/// Is the current token the start of an `FnHeader` / not a valid parse?
fn is_fn_front_matter(&mut self) -> bool {
fn check_fn_front_matter(&mut self) -> bool {
// We use an over-approximation here.
// `const const`, `fn const` won't parse, but we're not stepping over other syntax either.
const QUALS: [Symbol; 4] = [kw::Const, kw::Async, kw::Unsafe, kw::Extern];
Expand Down

0 comments on commit 9828559

Please sign in to comment.