Skip to content

Commit c247032

Browse files
committed
snapshot
1 parent f959559 commit c247032

File tree

3 files changed

+88
-28
lines changed

3 files changed

+88
-28
lines changed

lib/4.06.1/unstable/js_compiler.ml

Lines changed: 29 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -407202,8 +407202,8 @@ let flattern_tuple_pattern_vb
407202407202
let pvb_pat = self.pat self vb.pvb_pat in
407203407203
let pvb_expr = self.expr self vb.pvb_expr in
407204407204
let pvb_attributes = self.attributes self vb.pvb_attributes in
407205-
match pvb_pat.ppat_desc with
407206-
| Ppat_tuple xs when List.for_all is_simple_pattern xs ->
407205+
match pvb_pat.ppat_desc, pvb_expr.pexp_desc with
407206+
| Ppat_tuple xs, _ when List.for_all is_simple_pattern xs ->
407207407207
begin match Ast_open_cxt.destruct_open_tuple pvb_expr [] with
407208407208
| Some (wholes, es, tuple_attributes)
407209407209
when
@@ -407227,6 +407227,22 @@ let flattern_tuple_pattern_vb
407227407227
pvb_loc = vb.pvb_loc;
407228407228
pvb_attributes} :: acc
407229407229
end
407230+
| Ppat_record (lid_pats,_), Pexp_pack {pmod_desc= Pmod_ident id}
407231+
->
407232+
Ext_list.map_append lid_pats acc (fun (lid,pat) ->
407233+
match lid.txt with
407234+
| Lident s ->
407235+
{
407236+
pvb_pat = pat;
407237+
pvb_expr =
407238+
Ast_helper.Exp.ident ~loc:lid.loc
407239+
({lid with txt = Ldot(id.txt,s)});
407240+
pvb_attributes = [];
407241+
pvb_loc = pat.ppat_loc;
407242+
}
407243+
| _ ->
407244+
Location.raise_errorf ~loc:lid.loc "Not supported pattern match on modules"
407245+
)
407230407246
| _ ->
407231407247
{pvb_pat ;
407232407248
pvb_expr ;
@@ -407482,13 +407498,17 @@ let expr_mapper (self : mapper) (e : Parsetree.expression) =
407482407498
pvb_attributes;
407483407499
pvb_loc = _}], body)
407484407500
->
407485-
default_expr_mapper self
407486-
{e with
407487-
pexp_desc = Pexp_match(pvb_expr,
407488-
[{pc_lhs = p; pc_guard = None;
407489-
pc_rhs = body}]);
407490-
pexp_attributes = e.pexp_attributes @ pvb_attributes
407491-
}
407501+
begin match pvb_expr.pexp_desc with
407502+
| Pexp_pack _ -> default_expr_mapper self e
407503+
| _ ->
407504+
default_expr_mapper self
407505+
{e with
407506+
pexp_desc = Pexp_match(pvb_expr,
407507+
[{pc_lhs = p; pc_guard = None;
407508+
pc_rhs = body}]);
407509+
pexp_attributes = e.pexp_attributes @ pvb_attributes
407510+
}
407511+
end
407492407512
(* let [@warning "a"] {a;b} = c in body
407493407513
The attribute is attached to value binding,
407494407514
after the transformation value binding does not exist so we attach

lib/4.06.1/unstable/js_refmt_compiler.ml

Lines changed: 30 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -96751,7 +96751,7 @@ let if_ (a : t) (b : t) (c : t) : t =
9675196751
| Lprim(
9675296752
{primitive = Pnot ; args = [Lprim{primitive = Pintcomp Ceq ; args = [Lvar j; Lconst _] as args; loc}]})
9675396753
when Ident.same i j && eq_approx true_ c
96754-
-> Lprim{primitive = Pintcomp Ceq; args; loc}
96754+
-> Lprim{primitive = Pintcomp Cneq; args; loc}
9675596755
| _ -> Lifthenelse(a,b,c)
9675696756
end
9675796757
| _ -> Lifthenelse (a,b,c))
@@ -407202,8 +407202,8 @@ let flattern_tuple_pattern_vb
407202407202
let pvb_pat = self.pat self vb.pvb_pat in
407203407203
let pvb_expr = self.expr self vb.pvb_expr in
407204407204
let pvb_attributes = self.attributes self vb.pvb_attributes in
407205-
match pvb_pat.ppat_desc with
407206-
| Ppat_tuple xs when List.for_all is_simple_pattern xs ->
407205+
match pvb_pat.ppat_desc, pvb_expr.pexp_desc with
407206+
| Ppat_tuple xs, _ when List.for_all is_simple_pattern xs ->
407207407207
begin match Ast_open_cxt.destruct_open_tuple pvb_expr [] with
407208407208
| Some (wholes, es, tuple_attributes)
407209407209
when
@@ -407227,6 +407227,22 @@ let flattern_tuple_pattern_vb
407227407227
pvb_loc = vb.pvb_loc;
407228407228
pvb_attributes} :: acc
407229407229
end
407230+
| Ppat_record (lid_pats,_), Pexp_pack {pmod_desc= Pmod_ident id}
407231+
->
407232+
Ext_list.map_append lid_pats acc (fun (lid,pat) ->
407233+
match lid.txt with
407234+
| Lident s ->
407235+
{
407236+
pvb_pat = pat;
407237+
pvb_expr =
407238+
Ast_helper.Exp.ident ~loc:lid.loc
407239+
({lid with txt = Ldot(id.txt,s)});
407240+
pvb_attributes = [];
407241+
pvb_loc = pat.ppat_loc;
407242+
}
407243+
| _ ->
407244+
Location.raise_errorf ~loc:lid.loc "Not supported pattern match on modules"
407245+
)
407230407246
| _ ->
407231407247
{pvb_pat ;
407232407248
pvb_expr ;
@@ -407482,13 +407498,17 @@ let expr_mapper (self : mapper) (e : Parsetree.expression) =
407482407498
pvb_attributes;
407483407499
pvb_loc = _}], body)
407484407500
->
407485-
default_expr_mapper self
407486-
{e with
407487-
pexp_desc = Pexp_match(pvb_expr,
407488-
[{pc_lhs = p; pc_guard = None;
407489-
pc_rhs = body}]);
407490-
pexp_attributes = e.pexp_attributes @ pvb_attributes
407491-
}
407501+
begin match pvb_expr.pexp_desc with
407502+
| Pexp_pack _ -> default_expr_mapper self e
407503+
| _ ->
407504+
default_expr_mapper self
407505+
{e with
407506+
pexp_desc = Pexp_match(pvb_expr,
407507+
[{pc_lhs = p; pc_guard = None;
407508+
pc_rhs = body}]);
407509+
pexp_attributes = e.pexp_attributes @ pvb_attributes
407510+
}
407511+
end
407492407512
(* let [@warning "a"] {a;b} = c in body
407493407513
The attribute is attached to value binding,
407494407514
after the transformation value binding does not exist so we attach

lib/4.06.1/whole_compiler.ml

Lines changed: 29 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -410154,8 +410154,8 @@ let flattern_tuple_pattern_vb
410154410154
let pvb_pat = self.pat self vb.pvb_pat in
410155410155
let pvb_expr = self.expr self vb.pvb_expr in
410156410156
let pvb_attributes = self.attributes self vb.pvb_attributes in
410157-
match pvb_pat.ppat_desc with
410158-
| Ppat_tuple xs when List.for_all is_simple_pattern xs ->
410157+
match pvb_pat.ppat_desc, pvb_expr.pexp_desc with
410158+
| Ppat_tuple xs, _ when List.for_all is_simple_pattern xs ->
410159410159
begin match Ast_open_cxt.destruct_open_tuple pvb_expr [] with
410160410160
| Some (wholes, es, tuple_attributes)
410161410161
when
@@ -410179,6 +410179,22 @@ let flattern_tuple_pattern_vb
410179410179
pvb_loc = vb.pvb_loc;
410180410180
pvb_attributes} :: acc
410181410181
end
410182+
| Ppat_record (lid_pats,_), Pexp_pack {pmod_desc= Pmod_ident id}
410183+
->
410184+
Ext_list.map_append lid_pats acc (fun (lid,pat) ->
410185+
match lid.txt with
410186+
| Lident s ->
410187+
{
410188+
pvb_pat = pat;
410189+
pvb_expr =
410190+
Ast_helper.Exp.ident ~loc:lid.loc
410191+
({lid with txt = Ldot(id.txt,s)});
410192+
pvb_attributes = [];
410193+
pvb_loc = pat.ppat_loc;
410194+
}
410195+
| _ ->
410196+
Location.raise_errorf ~loc:lid.loc "Not supported pattern match on modules"
410197+
)
410182410198
| _ ->
410183410199
{pvb_pat ;
410184410200
pvb_expr ;
@@ -410434,13 +410450,17 @@ let expr_mapper (self : mapper) (e : Parsetree.expression) =
410434410450
pvb_attributes;
410435410451
pvb_loc = _}], body)
410436410452
->
410437-
default_expr_mapper self
410438-
{e with
410439-
pexp_desc = Pexp_match(pvb_expr,
410440-
[{pc_lhs = p; pc_guard = None;
410441-
pc_rhs = body}]);
410442-
pexp_attributes = e.pexp_attributes @ pvb_attributes
410443-
}
410453+
begin match pvb_expr.pexp_desc with
410454+
| Pexp_pack _ -> default_expr_mapper self e
410455+
| _ ->
410456+
default_expr_mapper self
410457+
{e with
410458+
pexp_desc = Pexp_match(pvb_expr,
410459+
[{pc_lhs = p; pc_guard = None;
410460+
pc_rhs = body}]);
410461+
pexp_attributes = e.pexp_attributes @ pvb_attributes
410462+
}
410463+
end
410444410464
(* let [@warning "a"] {a;b} = c in body
410445410465
The attribute is attached to value binding,
410446410466
after the transformation value binding does not exist so we attach

0 commit comments

Comments
 (0)