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

Unified Diff: src/parsing/parser-base.h

Issue 2650863002: [parser] Throw error when there are too many excluded properties (Closed)
Patch Set: fmt Created 3 years, 11 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 | test/cctest/test-parsing.cc » ('j') | test/cctest/test-parsing.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/parsing/parser-base.h
diff --git a/src/parsing/parser-base.h b/src/parsing/parser-base.h
index 57bfb69937cf012d3500abe0b63a90fdfc76543f..1087488157beabcbcf1c6c36d4d239af031f314a 100644
--- a/src/parsing/parser-base.h
+++ b/src/parsing/parser-base.h
@@ -2134,8 +2134,6 @@ typename ParserBase<Impl>::ExpressionT ParserBase<Impl>::ParsePropertyName(
scanner()->location(),
MessageTemplate::kInvalidDestructuringTarget);
} else {
- // TODO(gsathya): Throw error if number of properties >
- // Code::kMaxArguments
CheckDestructuringElement(expression, pos,
scanner()->location().end_pos);
}
@@ -2595,6 +2593,11 @@ typename ParserBase<Impl>::ExpressionT ParserBase<Impl>::ParseObjectLiteral(
// Computation of literal_index must happen before pre parse bailout.
int literal_index = function_state_->NextMaterializedLiteralIndex();
+ if (has_rest_property && properties->length() > Code::kMaxArguments) {
+ this->classifier()->RecordPatternError(Scanner::Location(pos, position()),
adamk 2017/01/23 21:47:45 Can you add a comment with a pointer to the code i
gsathya 2017/01/23 22:22:27 Done.
+ MessageTemplate::kTooManyArguments);
+ }
+
return factory()->NewObjectLiteral(properties, literal_index,
number_of_boilerplate_properties, pos,
has_rest_property);
« no previous file with comments | « no previous file | test/cctest/test-parsing.cc » ('j') | test/cctest/test-parsing.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698