Skip to content

Commit ba52f2a

Browse files
authored
Merge pull request #3787 from BuckleScript/integrate_with_upstream_compiler_changes
Integrate upstream compiler changes
2 parents 9d8c9c0 + e019a04 commit ba52f2a

Some content is hidden

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

50 files changed

+2019
-1146
lines changed

jscomp/core/js_dump.ml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -890,7 +890,7 @@ and expression_desc cxt (level:int) f x : cxt =
890890
E.array mutable_flag
891891
(Ext_list.map el drop_comment) ]
892892
)
893-
| Blk_module (Some labels) ->
893+
| Blk_module labels ->
894894
dbg_local_module f;
895895
P.paren_group f 1 (fun _ -> arguments cxt f
896896
[E.array Immutable
@@ -930,7 +930,7 @@ and expression_desc cxt (level:int) f x : cxt =
930930
#end
931931
| Blk_extension_slot
932932
| Blk_na
933-
| Blk_module None ->
933+
->
934934
dbg_block_create f;
935935
P.paren_group f 1 (fun _ -> arguments cxt f [tag; E.array mutable_flag el])
936936
)

jscomp/core/js_exp_make.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ let make_block ?comment
181181
if i <> 0 then merge_outer_comment des.(i-1) e else e)
182182
#end
183183
(* TODO: may overriden its previous comments *)
184-
| Blk_module (Some des)
184+
| Blk_module des
185185
-> Ext_list.map2 des es merge_outer_comment
186186
| _ -> es
187187
in

jscomp/core/js_of_lam_module.ml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@
2929

3030
module E = Js_exp_make
3131

32-
let make ?comment (args : J.expression list) =
32+
let make ?comment names (args : J.expression list) =
3333
E.make_block
3434
?comment E.zero_int_literal
35-
(Blk_module None) args Immutable
35+
(Blk_module names) args Immutable
3636

jscomp/core/js_of_lam_module.mli

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,5 +29,6 @@
2929

3030
val make :
3131
?comment:string ->
32+
string list ->
3233
J.expression list -> J.expression
3334

jscomp/core/lam_compile_global.ml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,9 @@ let expand_global_module_as_lam id env =
4545
~not_found:(fun id -> assert false)
4646
~found:(fun {signature ; _}
4747
->
48+
let names = Ocaml_types.map (fun name -> name) signature in
4849
Lam.prim
49-
~primitive:(Pmakeblock(0, Blk_module None, Immutable))
50+
~primitive:(Pmakeblock(0, Blk_module names, Immutable))
5051
~args:(
5152
let len = Ocaml_types.length signature in
5253
Ext_list.init len (fun i ->
@@ -64,7 +65,8 @@ let expand_global_module id env : J.expression =
6465
(Has_env env)
6566
~not_found:(fun _ -> assert false)
6667
~found:(fun {signature; _} ->
67-
Js_of_lam_module.make ~comment:id.name
68+
let names = Ocaml_types.map (fun name -> name) signature in
69+
Js_of_lam_module.make ~comment:id.name names
6870
(Ocaml_types.map (fun name -> E.ml_var_dot id name) signature )
6971
)
7072

jscomp/core/lam_tag_info.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ type t =
3333
| Blk_array
3434
| Blk_variant of string
3535
| Blk_record of string array
36-
| Blk_module of string list option
36+
| Blk_module of string list
3737
| Blk_extension_slot
3838
| Blk_na
3939
#if OCAML_VERSION =~ ">4.03.0" then

jscomp/runtime/caml_module.ml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ type shape =
3232
| Function
3333
| Lazy
3434
| Class
35-
| Module of shape array
35+
| Module of (shape * string) array
3636
| Value of Caml_obj_extern.t
3737
(* ATTENTION: check across versions *)
3838
module Array = Caml_array_extern
@@ -58,7 +58,7 @@ let init_mod (loc : string * int * int) (shape : shape) =
5858
struct_.(idx)<- v ;
5959
let len = Array.length comps in
6060
for i = 0 to len - 1 do
61-
loop comps.(i) v i
61+
loop (fst comps.(i)) v i
6262
done
6363
| Value v ->
6464
struct_.(idx) <- v in
@@ -80,12 +80,12 @@ let update_mod (shape : shape) (o : Caml_obj_extern.t) (n : Caml_obj_extern.t)
8080
| Module comps
8181
->
8282
for i = 0 to Array.length comps - 1 do
83-
aux comps.(i) (Caml_obj_extern.field o i) (Caml_obj_extern.field n i) o i
83+
aux (fst comps.(i)) (Caml_obj_extern.field o i) (Caml_obj_extern.field n i) o i
8484
done
8585
| Value _ -> () in
8686
match shape with
8787
| Module comps ->
8888
for i = 0 to Array.length comps - 1 do
89-
aux comps.(i) (Caml_obj_extern.field o i) (Caml_obj_extern.field n i) o i
89+
aux (fst comps.(i)) (Caml_obj_extern.field o i) (Caml_obj_extern.field n i) o i
9090
done
9191
| _ -> assert false

jscomp/test/basic_module_test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ var Mt_global = require("./mt_global.js");
88

99
var count = /* record */[/* contents */0];
1010

11-
var M = [Offset.M[/* Set */1]];
11+
var M = /* module */[/* Set */Offset.M[/* Set */1]];
1212

1313
function test(set) {
1414
count[0] = Curry._1(M[/* Set */0][/* cardinal */18], set) + count[0] | 0;

0 commit comments

Comments
 (0)