Support get/set as property name in object literal (#3340)

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
This commit is contained in:
Robert Fancsik 2019-11-22 16:05:38 +01:00 committed by GitHub
parent 279d4d4119
commit 62356796fc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 0 deletions

View File

@ -2472,6 +2472,7 @@ lexer_expect_object_literal_id (parser_context_t *context_p, /**< context */
#if ENABLED (JERRY_ES2015)
&& context_p->source_p[0] != LIT_CHAR_COMMA
&& context_p->source_p[0] != LIT_CHAR_RIGHT_BRACE
&& context_p->source_p[0] != LIT_CHAR_LEFT_PAREN
#endif /* ENABLED (JERRY_ES2015) */
&& context_p->source_p[0] != LIT_CHAR_COLON)
{
@ -2593,6 +2594,7 @@ lexer_scan_identifier (parser_context_t *context_p, /**< context */
#if ENABLED (JERRY_ES2015)
&& context_p->source_p[0] != LIT_CHAR_COMMA
&& context_p->source_p[0] != LIT_CHAR_RIGHT_BRACE
&& context_p->source_p[0] != LIT_CHAR_LEFT_PAREN
#endif /* ENABLED (JERRY_ES2015) */
&& context_p->source_p[0] != LIT_CHAR_COLON)
{

View File

@ -70,3 +70,8 @@ default:
assert(o.get == 8);
assert(o.set == 12);
}
var obj = { get() { return 5; }, set() { return 6; } };
assert (obj.get() === 5);
assert (obj.set() === 6);