Skip to content

Allow boolean literals as class method names#4606

Open
AlbertMarashi wants to merge 5 commits intoboa-dev:mainfrom
AlbertMarashi:claude/resolve-issue-4605-SWyvG
Open

Allow boolean literals as class method names#4606
AlbertMarashi wants to merge 5 commits intoboa-dev:mainfrom
AlbertMarashi:claude/resolve-issue-4605-SWyvG

Conversation

@AlbertMarashi
Copy link

This Pull Request fixes #4605.

It changes the following:

  • Updated the class declaration parser to recognize BooleanLiteral tokens (true and false) as valid method names in class definitions
  • Added support for boolean literals in regular methods, static methods, and getter/setter declarations
  • Added comprehensive test cases covering:
    • Instance methods with boolean literal names
    • Static methods with boolean literal names
    • Getter and setter properties with boolean literal names
  • Added a formatting test to ensure proper parsing and formatting of classes with boolean literal method names

The parser now correctly handles the ECMAScript specification which allows reserved words like true, false, and null to be used as property names in class declarations.

The class element parser was missing `TokenKind::BooleanLiteral(_)` in
4 token kind pattern matches, preventing `true` and `false` from being
used as class method identifiers. The `PropertyName` parser already
handled boolean literals correctly, so only the dispatch patterns in
`class_decl/mod.rs` needed updating.

Fixes boa-dev#4605

https://claude.ai/code/session_017EhjrAqAAkwhGjQkH7uWZy
@github-actions
Copy link

github-actions bot commented Feb 6, 2026

Test262 conformance changes

Test result main count PR count difference
Total 52,862 52,862 0
Passed 49,471 49,471 0
Ignored 2,249 2,249 0
Failed 1,142 1,142 0
Panics 0 0 0
Conformance 93.59% 93.59% 0.00%

@codecov
Copy link

codecov bot commented Feb 6, 2026

Codecov Report

❌ Patch coverage is 0% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 56.65%. Comparing base (6ddc2b4) to head (a6bffc0).
⚠️ Report is 645 commits behind head on main.

Files with missing lines Patch % Lines
.../statement/declaration/hoistable/class_decl/mod.rs 0.00% 4 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4606      +/-   ##
==========================================
+ Coverage   47.24%   56.65%   +9.40%     
==========================================
  Files         476      547      +71     
  Lines       46892    60065   +13173     
==========================================
+ Hits        22154    34029   +11875     
- Misses      24738    26036    +1298     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

claude and others added 3 commits February 6, 2026 04:46
When the VM's `handle_error` encounters a catchable error, and there's
an exception handler in the current frame (e.g. the async module
evaluation handler), it was storing the error without capturing any
backtrace or position info. This meant errors like "not a callable
function" TypeErrors created in Rust code had no source location when
surfaced through module promise rejection.

Two changes:
1. Capture the backtrace at the top of `handle_error`, before checking
   for exception handlers, so it's always available.
2. Inject the caller position from the shadow stack into native errors
   that lack one. This position is preserved through the JsError →
   JS Error object → JsValue → JsError round-trip that occurs during
   promise rejection, since it's stored on the Error object's internal
   data.

https://claude.ai/code/session_017EhjrAqAAkwhGjQkH7uWZy
@AlbertMarashi
Copy link
Author

Sorry about those other commits... I didn't mean to include them in this PR. They were reverted.

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.

Boa fails to parse reserved keyword class method identifiers

2 participants