Skip to content

Commit

Permalink
https://github.com/bellard/quickjs/pull/258
Browse files Browse the repository at this point in the history
  • Loading branch information
karurochari committed May 14, 2024
1 parent b81d4de commit f05e4d8
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
4 changes: 2 additions & 2 deletions quickjs.c
Original file line number Diff line number Diff line change
Expand Up @@ -20810,8 +20810,8 @@ static int __exception js_parse_property_name(JSParseState *s,
if (next_token(s))
goto fail1;
if (s->token.val == ':' || s->token.val == ',' ||
s->token.val == '}' || s->token.val == '(') {
is_non_reserved_ident = TRUE;
s->token.val == '}' || s->token.val == '(' ||
s->token.val == '=' ) {is_non_reserved_ident = TRUE;
goto ident_found;
}
prop_type = PROP_TYPE_GET + (name == JS_ATOM_set);
Expand Down
8 changes: 7 additions & 1 deletion tests/test_language.js
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,10 @@ function test_class()
assert(S.x === 42);
assert(S.y === 42);
assert(S.z === 42);
class P {
get = () => "123"
}
assert(new P().get() === "123");
};

function test_template()
Expand Down Expand Up @@ -363,8 +367,10 @@ function test_template_skip()
function test_object_literal()
{
var x = 0, get = 1, set = 2; async = 3;
a = { get: 2, set: 3, async: 4 };
a = { get: 2, set: 3, async: 4, get a(){ return this.get} };
assert(JSON.stringify(a), '{"get":2,"set":3,"async":4}');
assert(JSON.stringify(a), '{"get":2,"set":3,"async":4,"a":2}');
assert(a.a === 2);

a = { x, get, set, async };
assert(JSON.stringify(a), '{"x":0,"get":1,"set":2,"async":3}');
Expand Down

0 comments on commit f05e4d8

Please sign in to comment.