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

Unified Diff: src/expression-classifier.h

Issue 1178523002: Support rest parameters in arrow functions (Closed) Base URL: https://chromium.googlesource.com/v8/v8@master
Patch Set: Remove bogus DCHECK; function could be of simple x=>y form, thus not valid ArrowFormalParameters Created 5 years, 6 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/parser.h » ('j') | src/parser.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
« no previous file with comments | « no previous file | src/parser.h » ('j') | src/parser.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698