Index: src/parsing/parser.h |
diff --git a/src/parsing/parser.h b/src/parsing/parser.h |
index e3b7e70ae71f379bc8063061fdefdfc434a04861..ae0c7499663bda4d5d81e0035a43281bdf627047 100644 |
--- a/src/parsing/parser.h |
+++ b/src/parsing/parser.h |
@@ -1077,7 +1077,9 @@ class Parser : public ParserBase<ParserTraits> { |
void RecurseIntoSubpattern(AstNode* pattern, Expression* value) { |
Expression* old_value = current_value_; |
current_value_ = value; |
+ recursion_level_++; |
pattern->Accept(this); |
+ recursion_level_--; |
current_value_ = old_value; |
} |
@@ -1089,6 +1091,7 @@ class Parser : public ParserBase<ParserTraits> { |
bool IsAssignmentContext() const { return IsAssignmentContext(context_); } |
bool IsAssignmentContext(PatternContext c) const; |
bool IsBindingContext(PatternContext c) const; |
+ bool IsSubPattern() const { return recursion_level_ > 1; } |
PatternContext SetAssignmentContextIfNeeded(Expression* node); |
PatternContext SetInitializerContextIfNeeded(Expression* node); |
@@ -1110,6 +1113,7 @@ class Parser : public ParserBase<ParserTraits> { |
const DeclarationDescriptor* descriptor_; |
ZoneList<const AstRawString*>* names_; |
Expression* current_value_; |
+ int recursion_level_; |
bool* ok_; |
}; |