Short-circuits op-assignment for indexing and dotting.

This commit is contained in:
Stephen Chung
2021-02-23 20:03:28 +08:00
parent 93d970235e
commit 123e9d6901
2 changed files with 96 additions and 39 deletions

View File

@@ -287,6 +287,11 @@ impl Engine {
// See if it is built in.
if args.len() == 2 {
match run_builtin_binary_op(fn_name, args[0], args[1])? {
Some(v) => return Ok((v, false)),
None => (),
}
if is_ref {
let (first, second) = args.split_first_mut().unwrap();
@@ -295,11 +300,6 @@ impl Engine {
None => (),
}
}
match run_builtin_binary_op(fn_name, args[0], args[1])? {
Some(v) => return Ok((v, false)),
None => (),
}
}
// Return default value (if any)