-
Notifications
You must be signed in to change notification settings - Fork 470
Add Iterator.prototype bindings #7506
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
63ba4a3
9499875
273219e
c40bf36
23d80f9
229538d
98b4563
d95d4ef
118a9e0
4b56a1b
52bef1b
bfeb70f
5d161bc
57dbf3a
40bd4fa
c394634
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,9 @@ import * as Test from "./Test.mjs"; | |
import * as Primitive_object from "rescript/lib/es6/Primitive_object.js"; | ||
import * as Stdlib_AsyncIterator from "rescript/lib/es6/Stdlib_AsyncIterator.js"; | ||
|
||
import 'es-iterator-helpers/auto'; | ||
; | ||
|
||
let eq = Primitive_object.equal; | ||
|
||
let iterator = ((() => { | ||
|
@@ -16,24 +19,6 @@ let syncResult = { | |
contents: undefined | ||
}; | ||
|
||
if (!Iterator.prototype.forEach) { | ||
Iterator.prototype.forEach = function forEach(callback, thisArg) { | ||
if (typeof callback !== 'function') { | ||
throw new TypeError(callback + ' is not a function'); | ||
} | ||
|
||
let index = 0; | ||
let result = this.next(); | ||
|
||
while (!result.done) { | ||
callback.call(thisArg, result.value, index, this); | ||
result = this.next(); | ||
index++; | ||
} | ||
}; | ||
} | ||
; | ||
|
||
iterator.forEach(v => { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can't do make test locally anymore after this:
file:///Users/cristianocalcagno/GitHub/rescript-compiler/tests/tests/src/core/Core_IteratorTests.mjs:19 TypeError: iterator.forEach is not a function Node.js v20.19.0
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @cristianoc to run the unit tests, you'll need to update to node.js v22, which supports There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. looks like There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I've made a PR for updating |
||
if (v === "b") { | ||
syncResult.contents = "b"; | ||
|
@@ -45,7 +30,7 @@ iterator.forEach(v => { | |
Test.run([ | ||
[ | ||
"Core_IteratorTests.res", | ||
38, | ||
23, | ||
20, | ||
34 | ||
], | ||
|
@@ -77,7 +62,7 @@ await Stdlib_AsyncIterator.forEach(asyncIterator, v => { | |
Test.run([ | ||
[ | ||
"Core_IteratorTests.res", | ||
61, | ||
46, | ||
20, | ||
35 | ||
], | ||
|
@@ -113,7 +98,7 @@ await Stdlib_AsyncIterator.forEach(asyncIterator$1, v => { | |
Test.run([ | ||
[ | ||
"Core_IteratorTests.res", | ||
86, | ||
71, | ||
20, | ||
54 | ||
], | ||
|
@@ -127,4 +112,4 @@ export { | |
asyncResult, | ||
asyncIterator$1 as asyncIterator, | ||
} | ||
/* iterator Not a pure module */ | ||
/* Not a pure module */ |
Uh oh!
There was an error while loading. Please reload this page.