Skip to content

Commit 93beba5

Browse files
committed
Stdlib namespace for Core modules
1 parent 4cd02f9 commit 93beba5

File tree

83 files changed

+321
-778
lines changed

Some content is hidden

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

83 files changed

+321
-778
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/gentype/TranslateTypeExprFromTypes.ml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ let translate_constr ~config ~params_translation ~(path : Path.t) ~type_env =
8686
{dependencies = []; type_ = string_t}
8787
| (["Js"; "Types"; "bigint_val"] | ["BigInt"; "t"]), [] ->
8888
{dependencies = []; type_ = bigint_t}
89-
| (["Js"; "Date"; "t"] | ["Date"; "t"]), [] ->
89+
| (["Js"; "Date"; "t"] | ["Date"; "t"] | ["Stdlib_Date"; "t"]), [] ->
9090
{dependencies = []; type_ = date_t}
9191
| ["Map"; "t"], [param_translation1; param_translation2] ->
9292
{
@@ -110,7 +110,7 @@ let translate_constr ~config ~params_translation ~(path : Path.t) ~type_env =
110110
dependencies = param_translation.dependencies;
111111
type_ = weakset_t param_translation.type_;
112112
}
113-
| (["Js"; "Re"; "t"] | ["RegExp"; "t"]), [] ->
113+
| (["Js"; "Re"; "t"] | ["Stdlib_RegExp"; "t"]), [] ->
114114
{dependencies = []; type_ = regexp_t}
115115
| (["FB"; "unit"] | ["unit"]), [] -> {dependencies = []; type_ = unit_t}
116116
| ( (["FB"; "array"] | ["array"] | ["Js"; ("Array" | "Array2"); "t"]),

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/Int.js

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

22

3-
import * as $$Array from "./Array.js";
3+
import * as Stdlib_Array from "./Stdlib_Array.js";
44

55
function fromString(x, radix) {
66
let maybeInt = radix !== undefined ? parseInt(x, radix) : parseInt(x);
@@ -46,7 +46,7 @@ function range(start, end, optionsOpt) {
4646
let range$2 = options.inclusive === true ? range$1 + 1 | 0 : range$1;
4747
length = Math.ceil(range$2 / abs(step)) | 0;
4848
}
49-
return $$Array.fromInitializer(length, i => start + Math.imul(i, step) | 0);
49+
return Stdlib_Array.fromInitializer(length, i => start + Math.imul(i, step) | 0);
5050
}
5151

5252
function rangeWithOptions(start, end, options) {

lib/es6/List.js

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

22

3-
import * as $$Array from "./Array.js";
3+
import * as Stdlib_Array from "./Stdlib_Array.js";
44
import * as Primitive_int from "./Primitive_int.js";
55
import * as Primitive_option from "./Primitive_option.js";
66

@@ -648,7 +648,7 @@ function toArray(x) {
648648

649649
function toShuffled(xs) {
650650
let v = toArray(xs);
651-
$$Array.shuffle(v);
651+
Stdlib_Array.shuffle(v);
652652
return fromArray(v);
653653
}
654654

lib/es6/Stdlib.js

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
2+
3+
4+
let $$Array;
5+
6+
let $$Date;
7+
8+
let Dict;
9+
10+
let $$Promise;
11+
12+
let $$RegExp;
13+
14+
let Result;
15+
16+
let $$Set;
17+
18+
let $$String;
19+
20+
let $$Symbol;
21+
22+
export {
23+
$$Array,
24+
$$Date,
25+
Dict,
26+
$$Promise,
27+
$$RegExp,
28+
Result,
29+
$$Set,
30+
$$String,
31+
$$Symbol,
32+
}
33+
/* No side effect */
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)