A valid Iterator Helpers chain using filter(), take(), and toArray() unexpectedly throws:
TypeError: not a function
at return (native)
at toArray (native)
at <eval> (tools/quickjs_verify/iterator_chain_no_return.js:6:82)
The iterator should produce a one-element array instead.
The failure appears to occur when take(1) reaches its limit and attempts to close the iterator helper returned by filter().
Save the following as iterator_take_bug.js:
var result = Iterator.from([1, 2, 3, 4])
.filter(function (x) {
return x > 1;
})
.take(1)
.toArray();
print(JSON.stringify(result));
Run it using the QuickJS command-line interpreter:
./qjs iterator_take_bug.js
QuickJS version
QuickJS version/release: v0.15.1
Git commit: 93d3f7d
Operating system: Ubuntu 24.04 x86_64
A valid Iterator Helpers chain using
filter(),take(), andtoArray()unexpectedly throws:The iterator should produce a one-element array instead.
The failure appears to occur when
take(1)reaches its limit and attempts to close the iterator helper returned byfilter().Save the following as
iterator_take_bug.js:Run it using the QuickJS command-line interpreter:
QuickJS version
QuickJS version/release: v0.15.1
Git commit: 93d3f7d
Operating system: Ubuntu 24.04 x86_64