Skip to content

Commit 6e8f02c

Browse files
committed
Add @notundefined attribute to Stdlib_AsyncIterator
1 parent a37d160 commit 6e8f02c

File tree

4 files changed

+10
-2
lines changed

4 files changed

+10
-2
lines changed

runtime/Stdlib_AsyncIterator.res

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
@notUndefined
12
type t<'a>
23

34
type value<'a> = {

runtime/Stdlib_AsyncIterator.resi

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ See [async iterator protocols](https://developer.mozilla.org/en-US/docs/Web/Java
66
/**
77
The type representing an async iterator.
88
*/
9+
@notUndefined
910
type t<'a>
1011

1112
type value<'a> = {
@@ -69,7 +70,7 @@ let asyncIterator = AsyncIterator.make(async () => {
6970
let currentValue = context.contents
7071
// Increment current value
7172
context := currentValue + 1
72-
73+
7374
if currentValue >= 3 {
7475
AsyncIterator.done()
7576
} else {
@@ -93,7 +94,7 @@ let value: 'value => value<'value>
9394
let currentValue = context.contents
9495
// Increment current value
9596
context := currentValue + 1
96-
97+
9798
if currentValue >= 3 {
9899
AsyncIterator.done()
99100
} else {

tests/tests/src/option_wrapping_test.mjs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// Generated by ReScript, PLEASE EDIT WITH CARE
22

33
import * as Primitive_option from "rescript/lib/es6/Primitive_option.js";
4+
import * as Stdlib_AsyncIterator from "rescript/lib/es6/Stdlib_AsyncIterator.js";
45

56
let x6 = {
67
x: 42
@@ -44,6 +45,8 @@ let x31 = new DataView(new ArrayBuffer(0));
4445

4546
let x32 = new Map().values();
4647

48+
let x33 = Stdlib_AsyncIterator.make(() => Promise.resolve(Stdlib_AsyncIterator.value(true)));
49+
4750
let x99 = {};
4851

4952
let x1 = "hello";
@@ -90,6 +93,7 @@ export {
9093
x30,
9194
x31,
9295
x32,
96+
x33,
9397
x98,
9498
x99,
9599
}

tests/tests/src/option_wrapping_test.res

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ let x29 = Some(JsError.make(""))
2626
let x30 = Some(ArrayBuffer.make(0))
2727
let x31 = Some(ArrayBuffer.make(0)->DataView.fromBuffer)
2828
let x32 = Some((Map.make(): Map.t<string, string>)->Map.values)
29+
let x33 = Some(AsyncIterator.make(_ => AsyncIterator.value(true)->Promise.resolve))
2930

31+
let x97 = Some(Promise.resolve(true))
3032
let x98 = Some(list{})
3133
let x99 = Some((Dict.make(): dict<string>))

0 commit comments

Comments
 (0)