Add elvis operator for indexing.

This commit is contained in:
Stephen Chung
2022-06-12 00:32:12 +08:00
parent b9cbeb65d6
commit 2b44778a5c
7 changed files with 88 additions and 16 deletions

View File

@@ -60,6 +60,11 @@ impl Engine {
match chain_type {
#[cfg(not(feature = "no_index"))]
ChainType::Indexing => {
// Check for existence with the null conditional operator
if _parent_options.contains(ASTFlags::NEGATED) && target.is::<()>() {
return Ok((Dynamic::UNIT, false));
}
let pos = rhs.start_position();
match rhs {