ReviewOS

zig-utils/zig-js

Parser: admit private members in constructor callees

#807
Closed chris opened this 9 days ago ·
9 days ago

Parents: #496, #465. Found while validating #806.

At f83c419, valid new this.#Ctor() is rejected by Parser.parseNew before either execution tier runs, while parenthesized private-member construction is accepted. parseNew's member tail accepts only identifier tokens; the ordinary member tail already accepts private_name tokens under the lexical-class gate. Node executes the following as 7; both zig-js tiers report UnexpectedToken:

class Box {
  #Ctor = class { value = 7; };
  read(value = new this.#Ctor()) { return value.value; }
}
new Box().read();

Acceptance:

  • Parse private MemberExpressions in constructor callees with the same lexical private-name gate and later name validation as ordinary member access.
  • Cover explicit/omitted constructor arguments, chained/private accessors and parameter defaults; reject undeclared/out-of-class/private-super/optional-chain invalid forms.
  • Verify paired semantics, parser allocation/error paths, nonzero relevant conformance and full integration; link issue-specific commit and pushed CI.

No parenthesizing/source rewriting workaround, lexical-scope bypass or native lifecycle changes. Baseline/focused evidence is under /Users/chris/.cache/zig-js-parameter.jIiaXW/.

Completed integration (2026-08-28 UTC)

Implementation: d3170836. The measured local evidence above and in the linked implementation comments remains unchanged.

  • Complete pushed integration: CI 33144524467 at descendant 81978f7b completed successfully: 53 jobs passed, one scheduled-only job skipped, zero failures. This supersedes earlier pending, cancelled, or failed integration reports; those earlier runs are not counted as successful gates.

Closing this implemented issue as completed. Parent-roadmap work and independently tracked follow-ups remain open; this closure does not claim those broader scopes are finished.

9 days ago

Parser implementation now shares one private-member name reader across ordinary, optional and constructor-member tails. Six valid constructor/private-name forms and five invalid early-error forms pass in Debug, ReleaseSafe and unsuppressed TSan. Every allocation failure is replayed using a non-resizing test backing allocator; address-dependent Arena remap growth no longer makes the replay nondeterministic, and production hashing/allocation behavior is unchanged. Combined full Debug passes 2,042 tests with one platform skip and zero failures/leaks. Final upstream/paired measurements and landing are in progress.

9 days ago

Pushed as d3170836, followed by fully measured descendant f2340f27. Final evidence is recorded in #806: six valid/five invalid parser forms and allocation replay pass Debug, ReleaseSafe and unsuppressed TSan; 47 paired semantic controls pass, including explicit/omitted/private getter/chained constructor members. The default-tier class/function reports and extra59 new-expression controls are unchanged. Pushed integration remains pending; keeping this open.

Sign in to comment on this issue.