 Chromium Code Reviews
 Chromium Code Reviews Issue 2271063002:
  Centralize and standardize logic for ExpressionClassifier accumulation  (Closed) 
  Base URL: https://chromium.googlesource.com/v8/v8.git@master
    
  
    Issue 2271063002:
  Centralize and standardize logic for ExpressionClassifier accumulation  (Closed) 
  Base URL: https://chromium.googlesource.com/v8/v8.git@master| Index: src/parsing/expression-classifier.h | 
| diff --git a/src/parsing/expression-classifier.h b/src/parsing/expression-classifier.h | 
| index 9190e18c7dc7ffe5f4026190f2ff2abacc25d203..6b8deba1cbf21417e0c982d091f13ba7ff4f52c1 100644 | 
| --- a/src/parsing/expression-classifier.h | 
| +++ b/src/parsing/expression-classifier.h | 
| @@ -55,23 +55,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 | 
| @@ -381,6 +375,19 @@ 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. | 
| + // | 
| + void AccumulateFormalParameterContainmentErrors(ExpressionClassifier* inner) { | 
| 
nickie
2016/08/25 10:48:00
I'm not sure I understand entirely the logic of V8
 
adamk
2016/08/25 15:46:27
Agreed that I don't know of good guidelines for wh
 | 
| + Accumulate(inner, FormalParameterInitializerProduction | | 
| + AsyncArrowFormalParametersProduction); | 
| + } | 
| + | 
| V8_INLINE int GetNonPatternBegin() const { return non_pattern_begin_; } | 
| V8_INLINE void Discard() { |