ReviewOS

zig-utils/zig-js

ABI: implement private instanceof and iterator predicates

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

Parents: #163, #164 Depends on: #180

Implement the shared private user-code-aware instanceof and iterator-method predicates.

Acceptance:

  • Export exact JSC__JSValue__isInstanceOf and JSC__JSValue__isIterable signatures.
  • Match the pinned isInstanceOf precheck: non-object or non-has-instance constructors return false without throwing.
  • Run callable/custom/proxy has-instance behavior, prototype traversal, and Symbol.hasInstance hooks with abrupt completion.
  • Match JavaScriptCore hasIteratorMethod: non-object inputs return false; object Symbol.iterator lookup invokes getters, accepts callable methods, treats null/undefined as absent, and throws for non-callable values.
  • Publish user-code, invalid-prototype, foreign-value, and invalid-handle failures through #180 while returning false.
  • Preserve same-VM sibling values and the first already-pending exception.
  • Cover exact signatures, ordinary/custom/proxy instanceof, primitive prechecks, iterator getters/method validation, thrown hooks, sibling/foreign ownership, and pending-state behavior in the compile-link-runtime fixture.
  • Update both inventories and README/API documentation without changing public/extension counts.
9 days ago

Implemented and documented on main.

Evidence:

  • implementation: d1e4e321 (feat(abi): add private instance and iterator predicates)
  • published ABI/README evidence: dc91afda
  • focused private runtime fixture: 50/50 symbols linked and passed
  • Home inventory: 52/432 implemented, 380 pending
  • Bun core inventory: 52/422 implemented, 370 pending
  • public/extension accounting remains 117/19
  • public C and Bun inventory audits pass with zero drift

The implementation follows upstream JSC hasIteratorMethod object-only/GetMethod behavior and the pinned isInstanceOf internal-capability precheck. The fixture covers ordinary/custom/proxy has-instance behavior, non-capable constructors, invalid prototypes, getter and callability errors, thrown primitive identity, sibling/foreign ownership, and first-exception preservation.

Sign in to comment on this issue.