Chromium Code Reviews| Index: src/parsing/expression-classifier.h |
| diff --git a/src/parsing/expression-classifier.h b/src/parsing/expression-classifier.h |
| index 2c555b9c9886fa28972024f0ebd187c665c28ee7..8b782d93a3e81c5c9acdb64130cf824d932ef8c7 100644 |
| --- a/src/parsing/expression-classifier.h |
| +++ b/src/parsing/expression-classifier.h |
| @@ -25,7 +25,8 @@ namespace internal { |
| T(CoverInitializedNameProduction, 8) \ |
| T(TailCallExpressionProduction, 9) \ |
| T(AsyncArrowFormalParametersProduction, 10) \ |
| - T(AsyncBindingPatternProduction, 11) |
| + T(AsyncBindingPatternProduction, 11) \ |
| + T(AnnexBDuplicateProtoProduction, 12) |
|
adamk
2016/08/19 20:17:07
Let's just call this DuplicateProtoProduction.
gsathya
2016/08/19 23:22:57
Changed to ObjectLiteralProduction as discussed of
|
| template <typename Traits> |
| @@ -74,7 +75,8 @@ class ExpressionClassifier { |
| AllProductions = |
| (ExpressionProductions | PatternProductions | |
| FormalParametersProductions | ArrowFormalParametersProduction | |
| - CoverInitializedNameProduction | AsyncArrowFormalParametersProduction) |
| + CoverInitializedNameProduction | AsyncArrowFormalParametersProduction | |
| + AnnexBDuplicateProtoProduction) |
| }; |
| enum FunctionProperties : unsigned { |
| @@ -201,6 +203,15 @@ class ExpressionClassifier { |
| V8_INLINE const Error& tail_call_expression_error() const { |
| return reported_error(kTailCallExpressionProduction); |
| } |
| + |
| + V8_INLINE bool has_annexb_duplicate_proto() const { |
| + return !is_valid(AnnexBDuplicateProtoProduction); |
| + } |
| + |
| + V8_INLINE const Error& annexb_duplicate_proto_error() const { |
| + return reported_error(kAnnexBDuplicateProtoProduction); |
| + } |
| + |
| V8_INLINE const Error& async_arrow_formal_parameters_error() const { |
| return reported_error(kAsyncArrowFormalParametersProduction); |
| } |
| @@ -330,6 +341,14 @@ class ExpressionClassifier { |
| Add(Error(loc, message, kTailCallExpressionProduction, arg)); |
| } |
| + void RecordAnnexBDuplicateProtoError(const Scanner::Location& loc, |
| + MessageTemplate::Template message, |
| + const char* arg = nullptr) { |
| + if (has_annexb_duplicate_proto()) return; |
| + invalid_productions_ |= AnnexBDuplicateProtoProduction; |
| + Add(Error(loc, message, kAnnexBDuplicateProtoProduction, arg)); |
| + } |
| + |
| void ForgiveCoverInitializedNameError() { |
| if (!(invalid_productions_ & CoverInitializedNameProduction)) return; |
| Error& e = reported_error(kCoverInitializedNameProduction); |
| @@ -344,6 +363,13 @@ class ExpressionClassifier { |
| invalid_productions_ &= ~AssignmentPatternProduction; |
| } |
| + void ForgiveAnnexBDuplicateProtoError() { |
| + if (!(invalid_productions_ & AnnexBDuplicateProtoProduction)) return; |
| + Error& e = reported_error(kAnnexBDuplicateProtoProduction); |
| + e.kind = kUnusedError; |
| + invalid_productions_ &= ~AnnexBDuplicateProtoProduction; |
| + } |
| + |
| void Accumulate(ExpressionClassifier* inner, unsigned productions, |
| bool merge_non_patterns = true) { |
| DCHECK_EQ(inner->reported_errors_, reported_errors_); |