Skip to content

Fix "Private Class Fields Parsing Error" #5240

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

hvwyl
Copy link

@hvwyl hvwyl commented Jul 12, 2025

Fix "Private Class Fields Parsing Error" #5017

In js-scanner.c, the function scanner_scan_primary_expression_end does not trigger SCANNER_TYPE_CLASS_FIELD_INITIALIZER_END.(ASI for '<var_name> = \n #<priv_item_name>' stmt)
This causes the subsequent call scanner_release_next in parser_parse_class (located in js-parser-expr.c) to unexpectedly release the next scanner info.
As a result, the condition context_p->next_scanner_info_p->source_p != context_p->source_p (located in js-parser-expr.c) is triggered, leading to Unhandled exception: SyntaxError: Expected ';' token

The way to fix:
Add the condition for LEXER_HASHMARK(#) in scanner_scan_primary_expression_end (located in js-scanner.c)

JerryScript-DCO-1.0-Signed-off-by: hvwyl [email protected]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant