Skip to content

Commit d296a89

Browse files
committed
Stdlib namespace for Core modules
1 parent c220f80 commit d296a89

File tree

270 files changed

+1763
-2109
lines changed

Some content is hidden

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

270 files changed

+1763
-2109
lines changed

compiler/core/res_compmisc.ml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,10 @@ let initial_env ?modulename () =
5454
let initial = Env.initial_safe_string in
5555
let env =
5656
if !Clflags.nopervasives then initial
57-
else open_implicit_module "Pervasives" initial
57+
else
58+
initial
59+
|> open_implicit_module "Pervasives"
60+
|> open_implicit_module "Stdlib"
5861
in
5962
List.fold_left
6063
(fun env m -> open_implicit_module m env)

compiler/ml/ast_untagged_variants.ml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -179,8 +179,8 @@ let type_to_instanceof_backed_obj (t : Types.type_expr) =
179179
| Tconstr (path, _, _) when Path.same path Predef.path_array -> Some Array
180180
| Tconstr (path, _, _) -> (
181181
match Path.name path with
182-
| "Js_date.t" -> Some Date
183-
| "Js_re.t" -> Some RegExp
182+
| "Stdlib_Date.t" -> Some Date
183+
| "Stdlib_RegExp.t" -> Some RegExp
184184
| "Js_file.t" -> Some File
185185
| "Js_blob.t" -> Some Blob
186186
| _ -> None)

lib/es6/Pervasives.js

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

22

3-
import * as $$Error from "./Error.js";
4-
import * as Primitive_object from "./Primitive_object.js";
53
import * as Primitive_exceptions from "./Primitive_exceptions.js";
64

75
function failwith(s) {
@@ -117,21 +115,6 @@ function $at(l1, l2) {
117115
}
118116
}
119117

120-
function assertEqual(a, b) {
121-
if (!Primitive_object.notequal(a, b)) {
122-
return;
123-
}
124-
throw {
125-
RE_EXN_ID: "Assert_failure",
126-
_1: [
127-
"Pervasives.res",
128-
596,
129-
4
130-
],
131-
Error: new Error()
132-
};
133-
}
134-
135118
let max_int = 2147483647;
136119

137120
let infinity = Infinity;
@@ -144,8 +127,6 @@ let min_float = 2.22507385850720138e-308;
144127

145128
let epsilon_float = 2.22044604925031308e-16;
146129

147-
let panic = $$Error.panic;
148-
149130
export {
150131
failwith,
151132
invalid_arg,
@@ -166,7 +147,5 @@ export {
166147
bool_of_string_opt,
167148
int_of_string_opt,
168149
$at,
169-
panic,
170-
assertEqual,
171150
}
172151
/* No side effect */

lib/es6/Stdlib.js

Lines changed: 159 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,159 @@
1+
2+
3+
import * as Stdlib_Error from "./Stdlib_Error.js";
4+
import * as Primitive_object from "./Primitive_object.js";
5+
6+
function assertEqual(a, b) {
7+
if (!Primitive_object.notequal(a, b)) {
8+
return;
9+
}
10+
throw {
11+
RE_EXN_ID: "Assert_failure",
12+
_1: [
13+
"Stdlib.res",
14+
117,
15+
4
16+
],
17+
Error: new Error()
18+
};
19+
}
20+
21+
let $$Array;
22+
23+
let $$BigInt;
24+
25+
let Console;
26+
27+
let $$DataView;
28+
29+
let $$Date;
30+
31+
let Dict;
32+
33+
let Exn;
34+
35+
let $$Error;
36+
37+
let Float;
38+
39+
let Int;
40+
41+
let $$Intl;
42+
43+
let $$JSON;
44+
45+
let List;
46+
47+
let $$Math;
48+
49+
let Null;
50+
51+
let Nullable;
52+
53+
let $$Object;
54+
55+
let Option;
56+
57+
let Ordering;
58+
59+
let $$Promise;
60+
61+
let $$RegExp;
62+
63+
let Result;
64+
65+
let $$String;
66+
67+
let $$Symbol;
68+
69+
let Type;
70+
71+
let $$Iterator;
72+
73+
let $$AsyncIterator;
74+
75+
let $$Map;
76+
77+
let $$WeakMap;
78+
79+
let $$Set;
80+
81+
let $$WeakSet;
82+
83+
let $$ArrayBuffer;
84+
85+
let $$TypedArray;
86+
87+
let $$Float32Array;
88+
89+
let $$Float64Array;
90+
91+
let $$Int8Array;
92+
93+
let $$Int16Array;
94+
95+
let $$Int32Array;
96+
97+
let $$Uint8Array;
98+
99+
let $$Uint16Array;
100+
101+
let $$Uint32Array;
102+
103+
let $$Uint8ClampedArray;
104+
105+
let $$BigInt64Array;
106+
107+
let $$BigUint64Array;
108+
109+
let panic = Stdlib_Error.panic;
110+
111+
export {
112+
$$Array,
113+
$$BigInt,
114+
Console,
115+
$$DataView,
116+
$$Date,
117+
Dict,
118+
Exn,
119+
$$Error,
120+
Float,
121+
Int,
122+
$$Intl,
123+
$$JSON,
124+
List,
125+
$$Math,
126+
Null,
127+
Nullable,
128+
$$Object,
129+
Option,
130+
Ordering,
131+
$$Promise,
132+
$$RegExp,
133+
Result,
134+
$$String,
135+
$$Symbol,
136+
Type,
137+
$$Iterator,
138+
$$AsyncIterator,
139+
$$Map,
140+
$$WeakMap,
141+
$$Set,
142+
$$WeakSet,
143+
$$ArrayBuffer,
144+
$$TypedArray,
145+
$$Float32Array,
146+
$$Float64Array,
147+
$$Int8Array,
148+
$$Int16Array,
149+
$$Int32Array,
150+
$$Uint8Array,
151+
$$Uint16Array,
152+
$$Uint32Array,
153+
$$Uint8ClampedArray,
154+
$$BigInt64Array,
155+
$$BigUint64Array,
156+
panic,
157+
assertEqual,
158+
}
159+
/* No side effect */
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)