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; |