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

Unified Diff: src/parser.cc

Issue 5985010: Fix compile-problem in (currently) unused stand-alone preparser function. (Closed)
Patch Set: Addressed review comment Created 9 years, 12 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/preparser.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/parser.cc
diff --git a/src/parser.cc b/src/parser.cc
index 03819eea0192d1fa3ec207c27a5bbebd2e9e0be3..db034b3c17643f61d76b1dde9e246ea4ee9cb6a0 100644
--- a/src/parser.cc
+++ b/src/parser.cc
@@ -2995,14 +2995,22 @@ ObjectLiteral::Property* Parser::ParseObjectLiteralGetSet(bool is_getter,
// { ... , get foo() { ... }, ... , set foo(v) { ... v ... } , ... }
// We have already read the "get" or "set" keyword.
Token::Value next = Next();
- // TODO(820): Allow NUMBER and STRING as well (and handle array indices).
- if (next == Token::IDENTIFIER || Token::IsKeyword(next)) {
- Handle<String> name = GetSymbol(CHECK_OK);
+ bool is_keyword = Token::IsKeyword(next);
+ if (next == Token::IDENTIFIER || next == Token::NUMBER ||
+ next == Token::STRING || is_keyword) {
+ Handle<String> name;
+ if (is_keyword) {
+ name = Factory::LookupAsciiSymbol(Token::String(next));
+ } else {
+ name = GetSymbol(CHECK_OK);
+ }
FunctionLiteral* value =
ParseFunctionLiteral(name,
RelocInfo::kNoPosition,
DECLARATION,
CHECK_OK);
+ // Allow any number of parameters for compatiabilty with JSC.
+ // Specification only allows zero parameters for get and one for set.
ObjectLiteral::Property* property =
new ObjectLiteral::Property(is_getter, value);
return property;
« no previous file with comments | « no previous file | src/preparser.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698