Replace some bool params with an enum
This commit is contained in:
@@ -5,6 +5,7 @@ pub use TokenKind::*;
|
||||
|
||||
use crate::ast;
|
||||
use crate::ptr::P;
|
||||
use crate::util::case::Case;
|
||||
|
||||
use rustc_data_structures::stable_hasher::{HashStable, StableHasher};
|
||||
use rustc_data_structures::sync::Lrc;
|
||||
@@ -618,10 +619,10 @@ impl Token {
|
||||
self.is_non_raw_ident_where(|id| id.name == kw)
|
||||
}
|
||||
|
||||
/// Returns `true` if the token is a given keyword, `kw` or if `case_insensitive` is true and this token is an identifier equal to `kw` ignoring the case.
|
||||
pub fn is_keyword_case(&self, kw: Symbol, case_insensitive: bool) -> bool {
|
||||
/// Returns `true` if the token is a given keyword, `kw` or if `case` is `Insensitive` and this token is an identifier equal to `kw` ignoring the case.
|
||||
pub fn is_keyword_case(&self, kw: Symbol, case: Case) -> bool {
|
||||
self.is_keyword(kw)
|
||||
|| (case_insensitive
|
||||
|| (case == Case::Insensitive
|
||||
&& self.is_non_raw_ident_where(|id| {
|
||||
id.name.as_str().to_lowercase() == kw.as_str().to_lowercase()
|
||||
}))
|
||||
|
||||
Reference in New Issue
Block a user