Keyword can no longer be overloaded.
This commit is contained in:
11
src/token.rs
11
src/token.rs
@@ -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;
|
||||
|
Reference in New Issue
Block a user