Skip to content

Iterator-helper objects: .next value read returns undefined (bind-delegation impossible) #9068

Description

@proggeramlug

Reading .next as a VALUE off an iterator-helper object returns undefined; Node 26.5.1 returns the function.

const h: any = [1, 2].values().map((x: number) => x * 2);
console.log(typeof h.next);   // node: "function"   perry: "undefined"
const orig = h.next.bind(h);  // node: ok           perry: TypeError: Bind must be called on a function

Calling h.next() works fine — the class-id method tower dispatches it — only the property read misses, because ITERATOR_HELPER_CLASS_ID objects have no attached prototype carrying next and no bound-method synthesis on the read path. Consequence: the orig = it.next.bind(it)-style delegation that #9019/#9066 made work on the array/map/set/string/buffer/regexp families is impossible on helpers (an own next patch on a helper is honored since #9066 — only the read of the builtin is missing).

Found while validating #9066 on this exact probe; the buffer and regexp-string families resolve the read fine, so this is helper-specific. Pre-existing relative to #9066 (that PR touches the write/dispatch paths only, not property reads).

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