Chromium Code Reviews| Index: src/expression-classifier.h |
| diff --git a/src/expression-classifier.h b/src/expression-classifier.h |
| index 6edb99e8388427514f662f312c6341935150edac..b2f48edf28cb4a5af7d21a76a0eee80d3ce0cfb8 100644 |
| --- a/src/expression-classifier.h |
| +++ b/src/expression-classifier.h |
| @@ -36,6 +36,8 @@ class ExpressionClassifier { |
| StrictModeFormalParametersProduction = 1 << 4, |
| StrongModeFormalParametersProduction = 1 << 5, |
| ArrowFormalParametersProduction = 1 << 6, |
| + // Unlike the others; see note in RecordArrowFormalParametersWithRest. |
| + ArrowFormalParametersWithRestProduction = 1 << 7, |
|
Dmitry Lomov (no reviews)
2015/06/10 11:04:41
I am not too happy about this irregularity. We aro
wingo
2015/06/10 13:21:10
Done.
|
| PatternProductions = |
| (BindingPatternProduction | AssignmentPatternProduction), |
| @@ -73,6 +75,11 @@ class ExpressionClassifier { |
| return is_valid(ArrowFormalParametersProduction); |
| } |
| + bool is_arrow_formal_parameters_with_rest() const { |
| + return (invalid_productions_ & ArrowFormalParametersWithRestProduction) != |
| + 0; |
| + } |
| + |
| bool is_valid_formal_parameter_list_without_duplicates() const { |
| return is_valid(DistinctFormalParametersProduction); |
| } |
| @@ -153,6 +160,14 @@ class ExpressionClassifier { |
| arrow_formal_parameters_error_.arg = arg; |
| } |
| + void RecordArrowFormalParametersWithRest() { |
| + // Unlike the other TargetProduction flags, |
| + // ArrowFormalParametersWithRestProduction indicates the presence of a rest |
| + // parameter, not the presence of an error. It doesn't propagate out via |
| + // Accumulate() either, and doesn't have an associated location. |
| + invalid_productions_ |= ArrowFormalParametersWithRestProduction; |
| + } |
| + |
| void RecordDuplicateFormalParameterError(const Scanner::Location& loc) { |
| if (!is_valid_formal_parameter_list_without_duplicates()) return; |
| invalid_productions_ |= DistinctFormalParametersProduction; |