Skip to content

Commit 91cdffc

Browse files
committed
cleanup
1 parent 896e613 commit 91cdffc

File tree

4 files changed

+67
-176
lines changed

4 files changed

+67
-176
lines changed

jscomp/frontend/ast_await.ml

Lines changed: 16 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -7,52 +7,24 @@ let create_await_expression (e : Parsetree.expression) =
77

88
let create_await_module_expression ~module_type_name (e : Parsetree.module_expr)
99
=
10-
let txt = Longident.Ldot (Lident "Js", "import") in
11-
let _module_lid =
12-
match e with { pmod_desc = Pmod_ident lid } -> lid | _ -> assert false
13-
in
14-
let module_expr_without_attr = { e with pmod_attributes = [] } in
15-
let import_pexp_desc = Parsetree.Pexp_ident { txt; loc = e.pmod_loc } in
10+
let open Ast_helper in
1611
{
17-
module_expr_without_attr with
12+
e with
1813
pmod_desc =
1914
Pmod_unpack
2015
(create_await_expression
21-
{
22-
pexp_desc =
23-
Pexp_apply
24-
( {
25-
pexp_desc = import_pexp_desc;
26-
pexp_attributes = [];
27-
pexp_loc = e.pmod_loc;
28-
},
29-
[
30-
( Nolabel,
31-
{
32-
pexp_desc =
33-
Pexp_constraint
34-
( {
35-
pexp_desc = Pexp_pack module_expr_without_attr;
36-
pexp_loc = e.pmod_loc;
37-
pexp_attributes = [];
38-
},
39-
{
40-
ptyp_desc =
41-
Ptyp_package
42-
( {
43-
txt = Lident module_type_name;
44-
loc = e.pmod_loc;
45-
},
46-
[] );
47-
ptyp_loc = e.pmod_loc;
48-
ptyp_attributes = [];
49-
} );
50-
pexp_attributes = [];
51-
pexp_loc = e.pmod_loc;
52-
} );
53-
] );
54-
pexp_attributes =
55-
[ ({ txt = "res.await"; loc = Location.none }, PStr []) ];
56-
pexp_loc = e.pmod_loc;
57-
});
16+
(Exp.apply
17+
(Exp.ident ~loc:e.pmod_loc
18+
{
19+
txt = Longident.Ldot (Lident "Js", "import");
20+
loc = e.pmod_loc;
21+
})
22+
[
23+
( Nolabel,
24+
Exp.constraint_ ~loc:e.pmod_loc
25+
(Exp.pack ~loc:e.pmod_loc e)
26+
(Typ.package ~loc:e.pmod_loc
27+
{ txt = Lident module_type_name; loc = e.pmod_loc }
28+
[]) );
29+
]));
5830
}

lib/4.06.1/unstable/js_compiler.ml

Lines changed: 17 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -264812,54 +264812,26 @@ let create_await_expression (e : Parsetree.expression) =
264812264812

264813264813
let create_await_module_expression ~module_type_name (e : Parsetree.module_expr)
264814264814
=
264815-
let txt = Longident.Ldot (Lident "Js", "import") in
264816-
let _module_lid =
264817-
match e with { pmod_desc = Pmod_ident lid } -> lid | _ -> assert false
264818-
in
264819-
let module_expr_without_attr = { e with pmod_attributes = [] } in
264820-
let import_pexp_desc = Parsetree.Pexp_ident { txt; loc = e.pmod_loc } in
264815+
let open Ast_helper in
264821264816
{
264822-
module_expr_without_attr with
264817+
e with
264823264818
pmod_desc =
264824264819
Pmod_unpack
264825264820
(create_await_expression
264826-
{
264827-
pexp_desc =
264828-
Pexp_apply
264829-
( {
264830-
pexp_desc = import_pexp_desc;
264831-
pexp_attributes = [];
264832-
pexp_loc = e.pmod_loc;
264833-
},
264834-
[
264835-
( Nolabel,
264836-
{
264837-
pexp_desc =
264838-
Pexp_constraint
264839-
( {
264840-
pexp_desc = Pexp_pack module_expr_without_attr;
264841-
pexp_loc = e.pmod_loc;
264842-
pexp_attributes = [];
264843-
},
264844-
{
264845-
ptyp_desc =
264846-
Ptyp_package
264847-
( {
264848-
txt = Lident module_type_name;
264849-
loc = e.pmod_loc;
264850-
},
264851-
[] );
264852-
ptyp_loc = e.pmod_loc;
264853-
ptyp_attributes = [];
264854-
} );
264855-
pexp_attributes = [];
264856-
pexp_loc = e.pmod_loc;
264857-
} );
264858-
] );
264859-
pexp_attributes =
264860-
[ ({ txt = "res.await"; loc = Location.none }, PStr []) ];
264861-
pexp_loc = e.pmod_loc;
264862-
});
264821+
(Exp.apply
264822+
(Exp.ident ~loc:e.pmod_loc
264823+
{
264824+
txt = Longident.Ldot (Lident "Js", "import");
264825+
loc = e.pmod_loc;
264826+
})
264827+
[
264828+
( Nolabel,
264829+
Exp.constraint_ ~loc:e.pmod_loc
264830+
(Exp.pack ~loc:e.pmod_loc e)
264831+
(Typ.package ~loc:e.pmod_loc
264832+
{ txt = Lident module_type_name; loc = e.pmod_loc }
264833+
[]) );
264834+
]));
264863264835
}
264864264836

264865264837
end
@@ -271857,6 +271829,7 @@ let rec structure_mapper (self : mapper) (stru : Ast_structure.t) =
271857271829
~module_type_name:safe_module_type_name mb.pmb_expr;
271858271830
};
271859271831
}
271832+
(* module M = @res.await Belt.List *)
271860271833
:: structure_mapper self rest
271861271834
| _ -> self.structure_item self item :: structure_mapper self rest)
271862271835

lib/4.06.1/unstable/js_playground_compiler.ml

Lines changed: 17 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -266275,54 +266275,26 @@ let create_await_expression (e : Parsetree.expression) =
266275266275

266276266276
let create_await_module_expression ~module_type_name (e : Parsetree.module_expr)
266277266277
=
266278-
let txt = Longident.Ldot (Lident "Js", "import") in
266279-
let _module_lid =
266280-
match e with { pmod_desc = Pmod_ident lid } -> lid | _ -> assert false
266281-
in
266282-
let module_expr_without_attr = { e with pmod_attributes = [] } in
266283-
let import_pexp_desc = Parsetree.Pexp_ident { txt; loc = e.pmod_loc } in
266278+
let open Ast_helper in
266284266279
{
266285-
module_expr_without_attr with
266280+
e with
266286266281
pmod_desc =
266287266282
Pmod_unpack
266288266283
(create_await_expression
266289-
{
266290-
pexp_desc =
266291-
Pexp_apply
266292-
( {
266293-
pexp_desc = import_pexp_desc;
266294-
pexp_attributes = [];
266295-
pexp_loc = e.pmod_loc;
266296-
},
266297-
[
266298-
( Nolabel,
266299-
{
266300-
pexp_desc =
266301-
Pexp_constraint
266302-
( {
266303-
pexp_desc = Pexp_pack module_expr_without_attr;
266304-
pexp_loc = e.pmod_loc;
266305-
pexp_attributes = [];
266306-
},
266307-
{
266308-
ptyp_desc =
266309-
Ptyp_package
266310-
( {
266311-
txt = Lident module_type_name;
266312-
loc = e.pmod_loc;
266313-
},
266314-
[] );
266315-
ptyp_loc = e.pmod_loc;
266316-
ptyp_attributes = [];
266317-
} );
266318-
pexp_attributes = [];
266319-
pexp_loc = e.pmod_loc;
266320-
} );
266321-
] );
266322-
pexp_attributes =
266323-
[ ({ txt = "res.await"; loc = Location.none }, PStr []) ];
266324-
pexp_loc = e.pmod_loc;
266325-
});
266284+
(Exp.apply
266285+
(Exp.ident ~loc:e.pmod_loc
266286+
{
266287+
txt = Longident.Ldot (Lident "Js", "import");
266288+
loc = e.pmod_loc;
266289+
})
266290+
[
266291+
( Nolabel,
266292+
Exp.constraint_ ~loc:e.pmod_loc
266293+
(Exp.pack ~loc:e.pmod_loc e)
266294+
(Typ.package ~loc:e.pmod_loc
266295+
{ txt = Lident module_type_name; loc = e.pmod_loc }
266296+
[]) );
266297+
]));
266326266298
}
266327266299

266328266300
end
@@ -273320,6 +273292,7 @@ let rec structure_mapper (self : mapper) (stru : Ast_structure.t) =
273320273292
~module_type_name:safe_module_type_name mb.pmb_expr;
273321273293
};
273322273294
}
273295+
(* module M = @res.await Belt.List *)
273323273296
:: structure_mapper self rest
273324273297
| _ -> self.structure_item self item :: structure_mapper self rest)
273325273298

lib/4.06.1/whole_compiler.ml

Lines changed: 17 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -276554,54 +276554,26 @@ let create_await_expression (e : Parsetree.expression) =
276554276554

276555276555
let create_await_module_expression ~module_type_name (e : Parsetree.module_expr)
276556276556
=
276557-
let txt = Longident.Ldot (Lident "Js", "import") in
276558-
let _module_lid =
276559-
match e with { pmod_desc = Pmod_ident lid } -> lid | _ -> assert false
276560-
in
276561-
let module_expr_without_attr = { e with pmod_attributes = [] } in
276562-
let import_pexp_desc = Parsetree.Pexp_ident { txt; loc = e.pmod_loc } in
276557+
let open Ast_helper in
276563276558
{
276564-
module_expr_without_attr with
276559+
e with
276565276560
pmod_desc =
276566276561
Pmod_unpack
276567276562
(create_await_expression
276568-
{
276569-
pexp_desc =
276570-
Pexp_apply
276571-
( {
276572-
pexp_desc = import_pexp_desc;
276573-
pexp_attributes = [];
276574-
pexp_loc = e.pmod_loc;
276575-
},
276576-
[
276577-
( Nolabel,
276578-
{
276579-
pexp_desc =
276580-
Pexp_constraint
276581-
( {
276582-
pexp_desc = Pexp_pack module_expr_without_attr;
276583-
pexp_loc = e.pmod_loc;
276584-
pexp_attributes = [];
276585-
},
276586-
{
276587-
ptyp_desc =
276588-
Ptyp_package
276589-
( {
276590-
txt = Lident module_type_name;
276591-
loc = e.pmod_loc;
276592-
},
276593-
[] );
276594-
ptyp_loc = e.pmod_loc;
276595-
ptyp_attributes = [];
276596-
} );
276597-
pexp_attributes = [];
276598-
pexp_loc = e.pmod_loc;
276599-
} );
276600-
] );
276601-
pexp_attributes =
276602-
[ ({ txt = "res.await"; loc = Location.none }, PStr []) ];
276603-
pexp_loc = e.pmod_loc;
276604-
});
276563+
(Exp.apply
276564+
(Exp.ident ~loc:e.pmod_loc
276565+
{
276566+
txt = Longident.Ldot (Lident "Js", "import");
276567+
loc = e.pmod_loc;
276568+
})
276569+
[
276570+
( Nolabel,
276571+
Exp.constraint_ ~loc:e.pmod_loc
276572+
(Exp.pack ~loc:e.pmod_loc e)
276573+
(Typ.package ~loc:e.pmod_loc
276574+
{ txt = Lident module_type_name; loc = e.pmod_loc }
276575+
[]) );
276576+
]));
276605276577
}
276606276578

276607276579
end
@@ -283599,6 +283571,7 @@ let rec structure_mapper (self : mapper) (stru : Ast_structure.t) =
283599283571
~module_type_name:safe_module_type_name mb.pmb_expr;
283600283572
};
283601283573
}
283574+
(* module M = @res.await Belt.List *)
283602283575
:: structure_mapper self rest
283603283576
| _ -> self.structure_item self item :: structure_mapper self rest)
283604283577

0 commit comments

Comments
 (0)