fix(buffer): materialize Buffer iterators via spread + Array.from (#3909)#3975
Merged
Conversation
added 2 commits
June 1, 2026 14:15
) buf.keys()/values()/entries() worked via .next() and for-of but spread [...buf.keys()] / Array.from(buf.values()) returned an empty array — the BUFFER_ITERATOR_CLASS_ID was missing from js_array_clone_for_spread's is_array_iterator detection. Add it alongside the array/map/set/helper iterator class ids. + node-suite regression fixture.
proggeramlug
pushed a commit
to andrewtdiz/perry
that referenced
this pull request
Jun 1, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
buf.keys(),buf.values(), andbuf.entries()returned working iterator objects (.next()andfor...ofproduced the right byte indices/values), but[...buf.keys()]andArray.from(buf.values())returned an empty array.js_array_clone_for_spread— the runtime helper behind array spread andArray.from— recognizes iterator objects by class id, but itsis_array_iteratorcheck listed only the array/map/set/iterator-helper class ids, notBUFFER_ITERATOR_CLASS_ID. A Buffer iterator therefore fell through to the array-like.length/[i]materialization path (which a Buffer iterator doesn't support), yielding nothing. Added the buffer iterator class id alongside the others so spread andArray.fromdrive its.next()protocol like every other iterator.Testing
Verified byte-for-byte against
node --experimental-strip-types:.next()andfor...of(already working) stay covered. Addednode-suite/buffer/iterator-spreadregression fixture. Local suites green (perry-runtime,perry-hir),cargo fmt --checkclean.Closes #3909