镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content

ABI: implement private ToNumber coercion #183

Closed

Description

@chrisbbreuer

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

Implement the shared private full-ECMAScript ToNumber boundary.

Acceptance:

  • Export the exact Bun__JSValue__toNumber signature.
  • Preserve exact primitive conversion for undefined, null, booleans, int32/double values, and numeric/non-numeric strings.
  • Run ordinary object ToPrimitive with number hint, including Symbol.toPrimitive, valueOf, and toString ordering.
  • Throw TypeError for Symbol and BigInt inputs or primitive results.
  • Return NaN and publish conversion throws through ABI: implement private VM pending exceptions #180 VM pending exceptions, while ordinary numeric NaN leaves no exception pending.
  • Preserve same-VM sibling values and reject foreign-VM or invalid values safely.
  • Preserve an already pending first exception rather than replacing it.
  • Cover exact signatures, primitive matrices, coercion order, thrown hooks, Symbol/BigInt, sibling/foreign ownership, and NaN/exception distinction in the compile-link-runtime fixture.
  • Update both inventories and README/API documentation without changing public/extension counts.

Activity

  1. chrisbbreuer commented on Jul 17, 2026

    @chrisbbreuer
    MemberAuthor

    Implemented and documented on main.

    Evidence:

    • implementation: 3ae44959 (feat(abi): add private ToNumber coercion)
    • published ABI/README evidence: c1293524
    • focused private runtime fixture: 48/48 symbols linked and passed
    • Home inventory: 50/432 implemented, 382 pending
    • Bun core inventory: 50/422 implemented, 372 pending
    • public/extension accounting remains 117/19
    • public C and Bun inventory audits pass with zero drift

    The fixture covers primitive conversions and signed zero, ordinary NaN without pending state, same-VM sibling strings, Symbol.toPrimitive and fallback hook order, thrown hooks, Symbol/BigInt TypeError, foreign-value rejection, and first-pending-exception preservation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions