Keyword can no longer be overloaded.

This commit is contained in:
Stephen Chung
2021-03-01 17:17:13 +08:00
parent b7e864bb78
commit fc10df7d63
6 changed files with 79 additions and 183 deletions

View File

@@ -759,7 +759,6 @@ impl Token {
#[cfg(not(feature = "no_function"))]
pub(crate) fn into_function_name_for_override(self) -> Result<String, Self> {
match self {
Self::Reserved(s) if can_override_keyword(&s) => Ok(s),
Self::Custom(s) | Self::Identifier(s) if is_valid_identifier(s.chars()) => Ok(s),
_ => Err(self),
}
@@ -1630,16 +1629,6 @@ pub fn is_keyword_function(name: &str) -> bool {
}
}
/// Can this keyword be overridden as a function?
#[cfg(not(feature = "no_function"))]
#[inline(always)]
pub fn can_override_keyword(name: &str) -> bool {
match name {
KEYWORD_PRINT | KEYWORD_DEBUG | KEYWORD_TYPE_OF | KEYWORD_EVAL | KEYWORD_FN_PTR => true,
_ => false,
}
}
/// Is a text string a valid identifier?
pub fn is_valid_identifier(name: impl Iterator<Item = char>) -> bool {
let mut first_alphabetic = false;