Skip to content

fix(parser): class body strict mode + escaped keyword validation#184

Merged
ohah merged 1 commit intomainfrom
feature/class-strict-mode
Mar 20, 2026
Merged

fix(parser): class body strict mode + escaped keyword validation#184
ohah merged 1 commit intomainfrom
feature/class-strict-mode

Conversation

@ohah
Copy link
Copy Markdown
Owner

@ohah ohah commented Mar 20, 2026

Summary

  • class body 전체를 strict mode로 설정 (ECMAScript 10.2.1)
  • escaped yield/let/static/await를 class name으로 사용 시 SyntaxError
  • method param default에서 yield 사용 검증

Test plan

  • zig build test 통과
  • zig fmt --check src/ 통과
  • Test262 class-name-ident 9건 통과 확인

🤖 Generated with Claude Code

ECMAScript 10.2.1 specifies that all parts of a class (name, extends,
body) are strict mode code. Set is_strict_mode=true when entering
parseClassWithDecorators so that:
- yield/let/static as class names produce SyntaxError
- escaped forms (yi\u0065ld, l\u0065t, st\u0061tic) are also rejected
- yield in method default parameters (x = yield) is caught

Also fix escaped_keyword handling to allow escaped await (aw\u0061it) as
an identifier in script mode, since await is only reserved in Module
goal per ECMAScript 12.1.1.

Fixes 9 Test262 failures in expressions/class/.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@ohah ohah added the enhancement New feature or request label Mar 20, 2026
@ohah ohah self-assigned this Mar 20, 2026
@ohah ohah merged commit 3a385b5 into main Mar 20, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant