Skip to content

Commit 5f6ccf3

Browse files
authored
add ignore for every stdlib type t (#7348)
* add ignore for every stdlib type t (fixes rescript-lang/rescript-core#239) * ignore generated_mocha_test for formatting
1 parent 890ace4 commit 5f6ccf3

File tree

84 files changed

+552
-14
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

84 files changed

+552
-14
lines changed

lib/es6/Stdlib.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11

22

33
import * as Stdlib_Error from "./Stdlib_Error.js";
4+
import * as Stdlib_Global from "./Stdlib_Global.js";
45
import * as Primitive_object from "./Primitive_object.js";
56

67
function assertEqual(a, b) {
@@ -18,6 +19,10 @@ function assertEqual(a, b) {
1819
};
1920
}
2021

22+
let TimeoutId = Stdlib_Global.TimeoutId;
23+
24+
let IntervalId = Stdlib_Global.IntervalId;
25+
2126
let $$Array;
2227

2328
let $$BigInt;
@@ -109,6 +114,8 @@ let $$BigUint64Array;
109114
let panic = Stdlib_Error.panic;
110115

111116
export {
117+
TimeoutId,
118+
IntervalId,
112119
$$Array,
113120
$$BigInt,
114121
Console,

lib/es6/Stdlib_Global.js

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,12 @@
1-
/* This output is empty. Its source's type definitions, externals and/or unused code got optimized away. */
1+
2+
3+
4+
let TimeoutId = {};
5+
6+
let IntervalId = {};
7+
8+
export {
9+
TimeoutId,
10+
IntervalId,
11+
}
12+
/* No side effect */

lib/js/Stdlib.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
'use strict';
22

33
let Stdlib_Error = require("./Stdlib_Error.js");
4+
let Stdlib_Global = require("./Stdlib_Global.js");
45
let Primitive_object = require("./Primitive_object.js");
56

67
function assertEqual(a, b) {
@@ -18,6 +19,10 @@ function assertEqual(a, b) {
1819
};
1920
}
2021

22+
let TimeoutId = Stdlib_Global.TimeoutId;
23+
24+
let IntervalId = Stdlib_Global.IntervalId;
25+
2126
let $$Array;
2227

2328
let $$BigInt;
@@ -108,6 +113,8 @@ let $$BigUint64Array;
108113

109114
let panic = Stdlib_Error.panic;
110115

116+
exports.TimeoutId = TimeoutId;
117+
exports.IntervalId = IntervalId;
111118
exports.$$Array = $$Array;
112119
exports.$$BigInt = $$BigInt;
113120
exports.Console = Console;

lib/js/Stdlib_Global.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,10 @@
1-
/* This output is empty. Its source's type definitions, externals and/or unused code got optimized away. */
1+
'use strict';
2+
3+
4+
let TimeoutId = {};
5+
6+
let IntervalId = {};
7+
8+
exports.TimeoutId = TimeoutId;
9+
exports.IntervalId = IntervalId;
10+
/* No side effect */

runtime/Stdlib_Array.res

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -270,3 +270,5 @@ let findMap = (arr, f) => {
270270
@send external at: (array<'a>, int) => option<'a> = "at"
271271

272272
let last = a => a->get(a->length - 1)
273+
274+
external ignore: array<'a> => unit = "%ignore"

runtime/Stdlib_Array.resi

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1255,3 +1255,11 @@ Returns `None` if the array is empty.
12551255
```
12561256
*/
12571257
let last: array<'a> => option<'a>
1258+
1259+
/**
1260+
`ignore(array)` ignores the provided array and returns unit.
1261+
1262+
This helper is useful when you want to discard a value (for example, the result of an operation with side effects)
1263+
without having to store or process it further.
1264+
*/
1265+
external ignore: array<'a> => unit = "%ignore"

runtime/Stdlib_AsyncIterator.res

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,3 +35,5 @@ let make: (unit => promise<value<'value>>) => t<'value> = %raw(`function makeAsy
3535
}
3636
}
3737
}`)
38+
39+
external ignore: t<'a> => unit = "%ignore"

runtime/Stdlib_AsyncIterator.resi

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,3 +186,12 @@ main()->ignore
186186
```
187187
*/
188188
let forEach: (t<'a>, option<'a> => unit) => promise<unit>
189+
190+
/**
191+
`ignore(iterator)` ignores the provided async iterator and returns unit.
192+
193+
This helper is useful when you want to discard a value (for example, the result of an operation with side effects)
194+
without having to store or process it further.
195+
196+
*/
197+
external ignore: t<'a> => unit = "%ignore"

runtime/Stdlib_BigInt.res

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,3 +92,11 @@ external lsl: (bigint, bigint) => bigint = "%lslbigint"
9292
external asr: (bigint, bigint) => bigint = "%asrbigint"
9393

9494
let lnot = x => lxor(x, -1n)
95+
96+
/**
97+
`ignore(bigint)` ignores the provided bigint and returns unit.
98+
99+
This helper is useful when you want to discard a value (for example, the result of an operation with side effects)
100+
without having to store or process it further.
101+
*/
102+
external ignore: bigint => unit = "%ignore"

runtime/Stdlib_BigInt64Array.res

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,3 +52,11 @@ external fromArrayLikeOrIterable: 'a => t = "BigInt64Array.from"
5252
*/
5353
@val
5454
external fromArrayLikeOrIterableWithMap: ('a, ('b, int) => bigint) => t = "BigInt64Array.from"
55+
56+
/**
57+
`ignore(bigIntArray)` ignores the provided bigIntArray and returns unit.
58+
59+
This helper is useful when you want to discard a value (for example, the result of an operation with side effects)
60+
without having to store or process it further.
61+
*/
62+
external ignore: t => unit = "%ignore"

0 commit comments

Comments
 (0)