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

@@ -411,6 +411,7 @@ pub enum Expr {
///
/// ### Flags
///
/// [`NEGATED`][ASTFlags::NEGATED] = `?[` ... `]` (`[` ... `]` if unset)
/// [`BREAK`][ASTFlags::BREAK] = terminate the chain (recurse into the chain if unset)
Index(Box<BinaryExpr>, ASTFlags, Position),
/// lhs `&&` rhs
@@ -827,7 +828,7 @@ impl Expr {
#[cfg(not(feature = "no_object"))]
Token::Period | Token::Elvis => return true,
#[cfg(not(feature = "no_index"))]
Token::LeftBracket => return true,
Token::LeftBracket | Token::QuestionBracket => return true,
_ => (),
}