Skip to content

Commit f588210

Browse files
authored
Co-authored-by: karurochari <nope>
1 parent 5a7e578 commit f588210

File tree

2 files changed

+13
-4
lines changed

2 files changed

+13
-4
lines changed

quickjs.c

+9-3
Original file line numberDiff line numberDiff line change
@@ -20837,7 +20837,7 @@ static int __exception js_parse_property_name(JSParseState *s,
2083720837
goto fail1;
2083820838
if (s->token.val == ':' || s->token.val == ',' ||
2083920839
s->token.val == '}' || s->token.val == '(' ||
20840-
s->token.val == '=' ) {
20840+
s->token.val == '=') {
2084120841
is_non_reserved_ident = TRUE;
2084220842
goto ident_found;
2084320843
}
@@ -20853,7 +20853,8 @@ static int __exception js_parse_property_name(JSParseState *s,
2085320853
if (next_token(s))
2085420854
goto fail1;
2085520855
if (s->token.val == ':' || s->token.val == ',' ||
20856-
s->token.val == '}' || s->token.val == '(') {
20856+
s->token.val == '}' || s->token.val == '(' ||
20857+
s->token.val == '=') {
2085720858
is_non_reserved_ident = TRUE;
2085820859
goto ident_found;
2085920860
}
@@ -21609,7 +21610,12 @@ static __exception int js_parse_class(JSParseState *s, BOOL is_class_expr,
2160921610
goto fail;
2161021611
continue;
2161121612
}
21612-
is_static = (s->token.val == TOK_STATIC);
21613+
is_static = FALSE;
21614+
if (s->token.val == TOK_STATIC) {
21615+
int next = peek_token(s, TRUE);
21616+
if (!(next == ';' || next == '}' || next == '(' || next == '='))
21617+
is_static = TRUE;
21618+
}
2161321619
prop_type = -1;
2161421620
if (is_static) {
2161521621
if (next_token(s))

tests/test_language.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -343,10 +343,13 @@ function test_class()
343343
assert(S.x === 42);
344344
assert(S.y === 42);
345345
assert(S.z === 42);
346+
346347
class P {
347-
get = () => "123"
348+
get = () => "123";
349+
static() { return 42; }
348350
}
349351
assert(new P().get() === "123");
352+
assert(new P().static() === 42);
350353
};
351354

352355
function test_template()

0 commit comments

Comments
 (0)