From: Fabrice Bellard Date: Sat, 7 Nov 2026 11:45:55 +0000 (+0100) Subject: fixed regexp skipping after template or private field (#596) X-Git-Url: https://git.kaiwu.me/?a=commitdiff_plain;h=673c6220cfca542bec0260a103d6ac01ee11c665;p=quickjs.git fixed regexp skipping after template or private field (#596) --- diff --git a/quickjs.c b/quickjs.c index d4ab4c3..0600dee 100644 --- a/quickjs.c +++ b/quickjs.c @@ -25403,9 +25403,11 @@ static BOOL is_regexp_allowed(int tok) case TOK_FALSE: case TOK_TRUE: case TOK_THIS: + case TOK_PRIVATE_NAME: case ')': case ']': case '}': /* XXX: regexp may occur after */ + case TOK_TEMPLATE: /* complete template literal; "${" is handled by the caller */ case TOK_IDENT: return FALSE; default: @@ -25485,6 +25487,7 @@ static int js_parse_skip_parens_token(JSParseState *s, int *pbits, BOOL no_line_ if (level >= sizeof(state)) goto done; state[level++] = '`'; + last_tok = '('; /* regexp allowed after it */ } break; case TOK_EOF: