Index: src/ast.h |
diff --git a/src/ast.h b/src/ast.h |
index 1366041387215bc4c018c4b1650d39ff5f6549c4..b497427bf228aaf59126cc0023d5d68486ba7cd5 100644 |
--- a/src/ast.h |
+++ b/src/ast.h |
@@ -368,6 +368,10 @@ class Expression : public AstNode { |
// True iff the expression is a valid target for an assignment. |
bool IsValidReferenceExpressionOrThis() const; |
+ bool IsPatternOrLiteral() const { |
+ return IsObjectLiteral() || IsArrayLiteral(); |
+ } |
+ |
// Expression type bounds |
Bounds bounds() const { return bounds_; } |
void set_bounds(Bounds bounds) { bounds_ = bounds; } |
@@ -2356,6 +2360,11 @@ class Assignment final : public Expression { |
// This check relies on the definition order of token in token.h. |
bool is_compound() const { return op() > Token::ASSIGN; } |
+ // Returns true if op is `=` and LHS is might be a pattern |
+ bool IsDestructuring() const { |
+ return op() == Token::ASSIGN && target()->IsPatternOrLiteral(); |
+ } |
+ |
static int num_ids() { return parent_num_ids() + 2; } |
BailoutId AssignmentId() const { return BailoutId(local_id(0)); } |