Skip to content

Commit 1cff795

Browse files
committed
tentative fix for #3865
1 parent 6541ab7 commit 1cff795

File tree

14 files changed

+1159
-372
lines changed

14 files changed

+1159
-372
lines changed

jscomp/core/js_dump.ml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -854,7 +854,8 @@ and expression_desc cxt (level:int) f x : cxt =
854854
else
855855
E.runtime_call Js_runtime_modules.option "some" [e])
856856
| Caml_block(el,_, _, Blk_module fields) ->
857-
expression_desc cxt (level:int) f (Object (List.combine fields el))
857+
expression_desc cxt (level:int) f (Object (
858+
(Ext_list.map_combine fields el Ext_ident.convert)))
858859
| Caml_block( el, mutable_flag, tag, tag_info)
859860
->
860861
(* Note that, if we ignore more than tag [0] we loose some information

jscomp/core/js_exp_make.ml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,7 @@ let dot ?comment (e0 : t) (e1 : string) : t =
163163

164164

165165
let module_access (e : t) (name : string) (pos : int32) =
166+
let name = Ext_ident.convert name in
166167
match e.expression_desc with
167168
| Caml_block (l, _, _,_) when no_side_effect e ->
168169
(match Ext_list.nth_opt l (Int32.to_int pos) with

jscomp/ext/ext_list.ml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,13 @@ let rec has_string l f =
6868
| x1 :: x2 :: x3 :: x4 ->
6969
x1 = f || x2 = f || x3 = f || has_string x4 f
7070

71+
let rec map_combine l1 l2 f =
72+
match (l1, l2) with
73+
([], []) -> []
74+
| (a1::l1, a2::l2) ->
75+
(f a1, a2) :: map_combine l1 l2 f
76+
| (_, _) ->
77+
invalid_arg "Ext_list.map_combine"
7178

7279
let rec map_split_opt
7380
(xs : 'a list) (f : 'a -> 'b option * 'c option)

jscomp/ext/ext_list.mli

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,18 @@ val map :
2828
('a -> 'b) ->
2929
'b list
3030

31+
val map_combine :
32+
'a list ->
33+
'b list ->
34+
('a -> 'c) ->
35+
('c * 'b) list
36+
3137
val has_string :
3238
string list ->
3339
string ->
3440
bool
41+
42+
3543
val map_split_opt :
3644
'a list ->
3745
('a -> 'b option * 'c option) ->

0 commit comments

Comments
 (0)