Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(81)

Unified Diff: src/parsing/expression-classifier.h

Issue 2271063002: Centralize and standardize logic for ExpressionClassifier accumulation (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Rebased Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/parsing/parser.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/parsing/expression-classifier.h
diff --git a/src/parsing/expression-classifier.h b/src/parsing/expression-classifier.h
index a6b9f869316dea207de372b5e6a3a6f44035fc3c..87b3bbe50ae694273da5bbdfa685abe7db78b5ef 100644
--- a/src/parsing/expression-classifier.h
+++ b/src/parsing/expression-classifier.h
@@ -57,23 +57,17 @@ class ExpressionClassifier {
const char* arg;
};
+ // clang-format off
enum TargetProduction : unsigned {
#define DEFINE_PRODUCTION(NAME, CODE) NAME = 1 << CODE,
ERROR_CODES(DEFINE_PRODUCTION)
#undef DEFINE_PRODUCTION
- ExpressionProductions =
- (ExpressionProduction | FormalParameterInitializerProduction |
- TailCallExpressionProduction),
- PatternProductions = (BindingPatternProduction |
- AssignmentPatternProduction | LetPatternProduction),
- FormalParametersProductions = (DistinctFormalParametersProduction |
- StrictModeFormalParametersProduction),
- AllProductions =
- (ExpressionProductions | PatternProductions |
- FormalParametersProductions | ArrowFormalParametersProduction |
- ObjectLiteralProduction | AsyncArrowFormalParametersProduction)
+#define DEFINE_ALL_PRODUCTIONS(NAME, CODE) NAME |
+ AllProductions = ERROR_CODES(DEFINE_ALL_PRODUCTIONS) /* | */ 0
+#undef DEFINE_ALL_PRODUCTIONS
};
+ // clang-format on
enum FunctionProperties : unsigned {
NonSimpleParameter = 1 << 0
@@ -373,6 +367,20 @@ class ExpressionClassifier {
reported_errors_end_;
}
+ // Accumulate errors that can be arbitrarily deep in an expression.
+ // These correspond to the ECMAScript spec's 'Contains' operation
+ // on productions. This includes:
+ //
+ // - YieldExpression is disallowed in arrow parameters in a generator.
+ // - AwaitExpression is disallowed in arrow parameters in an async function.
+ // - AwaitExpression is disallowed in async arrow parameters.
+ //
+ V8_INLINE void AccumulateFormalParameterContainmentErrors(
+ ExpressionClassifier* inner) {
+ Accumulate(inner, FormalParameterInitializerProduction |
+ AsyncArrowFormalParametersProduction);
+ }
+
V8_INLINE int GetNonPatternBegin() const { return non_pattern_begin_; }
V8_INLINE void Discard() {
« no previous file with comments | « no previous file | src/parsing/parser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698