Do not test for built-in's when operands are not built-in.
This commit is contained in:
parent
c501b34191
commit
0d933d865a
@ -289,18 +289,26 @@ impl Engine {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// See if it is built in.
|
// See if it is built in.
|
||||||
if args.len() == 2 {
|
if args.len() == 2 && !args[0].is_variant() && !args[1].is_variant() {
|
||||||
match run_builtin_binary_op(fn_name, args[0], args[1])? {
|
match run_builtin_binary_op(fn_name, args[0], args[1])? {
|
||||||
Some(v) => return Ok((v, false)),
|
Some(v) => return Ok((v, false)),
|
||||||
None => (),
|
None => (),
|
||||||
}
|
}
|
||||||
|
|
||||||
if is_ref && fn_name.ends_with('=') {
|
// Op-assignment?
|
||||||
let (first, second) = args.split_first_mut().unwrap();
|
if is_ref {
|
||||||
|
match fn_name {
|
||||||
|
_ if fn_name.len() <= 1 => (),
|
||||||
|
"==" | "!=" | ">=" | "<=" => (),
|
||||||
|
_ if fn_name.ends_with('=') => {
|
||||||
|
let (first, second) = args.split_first_mut().unwrap();
|
||||||
|
|
||||||
match run_builtin_op_assignment(fn_name, first, second[0])? {
|
match run_builtin_op_assignment(fn_name, first, second[0])? {
|
||||||
Some(_) => return Ok((Dynamic::UNIT, false)),
|
Some(_) => return Ok((Dynamic::UNIT, false)),
|
||||||
None => (),
|
None => (),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
_ => (),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1659,25 +1659,25 @@ pub fn is_valid_identifier(name: impl Iterator<Item = char>) -> bool {
|
|||||||
|
|
||||||
#[cfg(feature = "unicode-xid-ident")]
|
#[cfg(feature = "unicode-xid-ident")]
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
fn is_id_first_alphabetic(x: char) -> bool {
|
pub fn is_id_first_alphabetic(x: char) -> bool {
|
||||||
unicode_xid::UnicodeXID::is_xid_start(x)
|
unicode_xid::UnicodeXID::is_xid_start(x)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "unicode-xid-ident")]
|
#[cfg(feature = "unicode-xid-ident")]
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
fn is_id_continue(x: char) -> bool {
|
pub fn is_id_continue(x: char) -> bool {
|
||||||
unicode_xid::UnicodeXID::is_xid_continue(x)
|
unicode_xid::UnicodeXID::is_xid_continue(x)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(not(feature = "unicode-xid-ident"))]
|
#[cfg(not(feature = "unicode-xid-ident"))]
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
fn is_id_first_alphabetic(x: char) -> bool {
|
pub fn is_id_first_alphabetic(x: char) -> bool {
|
||||||
x.is_ascii_alphabetic()
|
x.is_ascii_alphabetic()
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(not(feature = "unicode-xid-ident"))]
|
#[cfg(not(feature = "unicode-xid-ident"))]
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
fn is_id_continue(x: char) -> bool {
|
pub fn is_id_continue(x: char) -> bool {
|
||||||
x.is_ascii_alphanumeric() || x == '_'
|
x.is_ascii_alphanumeric() || x == '_'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user