Skip to content

Let a decorated class body observe the class its decorators return - #38731

Open
robobun wants to merge 9 commits into
mainfrom
farm/e0367c7d/decorator-inner-class-binding
Open

Let a decorated class body observe the class its decorators return#38731
robobun wants to merge 9 commits into
mainfrom
farm/e0367c7d/decorator-inner-class-binding

js_parser: relocate a decorated class's static fields all or nothing

333c9d1
Select commit
Loading
Failed to load commit list.
Claude / Claude Code Review completed Aug 15, 2026 in 34m 37s

Code review found 1 important issue

Found 2 candidates, confirmed 1. See review comments for details.

Details

Severity Count
🔴 Important 1
🟡 Nit 0
🟣 Pre-existing 0
Severity File:Line Issue
🔴 Important src/js_parser/lower/lower_decorators.rs:1285-1293 relocate_static_fields gate lets private static fields and static auto-accessors slip through, breaking the all-or-nothi

Annotations

Check failure on line 1293 in src/js_parser/lower/lower_decorators.rs

See this annotation in the file changed.

@claude claude / Claude Code Review

relocate_static_fields gate lets private static fields and static auto-accessors slip through, breaking the all-or-nothing ordering invariant

The `relocate_static_fields` "all or nothing" gate only checks props for which `is_plain_static_field` is true, so a private static field or an undecorated `static accessor` contributes vacuously and never disables relocation — but neither is emitted through step 7's `static_element_order` loop. `@wrap class Foo { static y = B(); static #x = A(); }` now runs `A` (in-body) before `B` (relocated), and `@wrap class Foo { static a = ...; static accessor b = ...; }` now emits `__privateAdd(orig, _b,