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

Unified Diff: src/preparser.h

Issue 329413002: Throw syntax error when a getter/setter has the wrong number of params (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Add test exception Created 6 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 | « src/parser.cc ('k') | src/preparser.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/preparser.h
diff --git a/src/preparser.h b/src/preparser.h
index 828f284c1648717b073bf125a54cb64a65ab6293..94f42797740cd27bc31726dd03341fee360a305d 100644
--- a/src/preparser.h
+++ b/src/preparser.h
@@ -1044,6 +1044,7 @@ class PreParserTraits {
bool is_generator,
int function_token_position,
FunctionLiteral::FunctionType type,
+ FunctionLiteral::ArityRestriction arity_restriction,
bool* ok);
private:
@@ -1173,6 +1174,7 @@ class PreParser : public ParserBase<PreParserTraits> {
bool is_generator,
int function_token_pos,
FunctionLiteral::FunctionType function_type,
+ FunctionLiteral::ArityRestriction arity_restriction,
bool* ok);
void ParseLazyFunctionLiteralBody(bool* ok);
@@ -1552,9 +1554,9 @@ typename ParserBase<Traits>::ExpressionT ParserBase<Traits>::ParseObjectLiteral(
false, // reserved words are allowed here
false, // not a generator
RelocInfo::kNoPosition, FunctionLiteral::ANONYMOUS_EXPRESSION,
+ is_getter ? FunctionLiteral::GETTER_ARITY
+ : FunctionLiteral::SETTER_ARITY,
CHECK_OK);
- // Allow any number of parameters for compatibilty with JSC.
- // Specification only allows zero parameters for get and one for set.
typename Traits::Type::ObjectLiteralProperty property =
factory()->NewObjectLiteralProperty(is_getter, value, next_pos);
if (this->IsBoilerplateProperty(property)) {
@@ -2056,6 +2058,7 @@ ParserBase<Traits>::ParseMemberExpression(bool* ok) {
is_generator,
function_token_position,
function_type,
+ FunctionLiteral::NORMAL_ARITY,
CHECK_OK);
} else {
result = ParsePrimaryExpression(CHECK_OK);
« no previous file with comments | « src/parser.cc ('k') | src/preparser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698