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

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

Issue 2255353002: [parser] Allow duplicate __proto__ keys in patterns (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: review comments 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-base.h » ('j') | src/parsing/parser-base.h » ('J')
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 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_);
« no previous file with comments | « no previous file | src/parsing/parser-base.h » ('j') | src/parsing/parser-base.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698