Skip to content

Commit 9168c26

Browse files
committed
cleanup
1 parent da1eeff commit 9168c26

File tree

4 files changed

+124
-156
lines changed

4 files changed

+124
-156
lines changed

jscomp/frontend/ast_exp_apply.ml

Lines changed: 31 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -132,46 +132,38 @@ let app_exp_mapper (e : exp) (self : Bs_ast_mapper.mapper) (fn : exp)
132132
pexp_loc = e.pexp_loc;
133133
pexp_attributes = e.pexp_attributes;
134134
}
135-
| _ -> (
136-
match fn with
137-
| { pexp_desc = Pexp_tuple xs; pexp_attributes = tuple_attrs } ->
138-
bound new_obj_arg (fun bounded_obj_arg ->
139-
{
140-
pexp_desc =
141-
Pexp_tuple
142-
(Ext_list.map xs (fun fn ->
143-
match fn.pexp_desc with
144-
| Pexp_construct (ctor, None) ->
145-
{
146-
fn with
147-
pexp_desc =
148-
Pexp_construct
149-
(ctor, Some bounded_obj_arg);
150-
}
151-
| Pexp_apply (fn, args) ->
152-
Bs_ast_invariant
153-
.warn_discarded_unused_attributes
154-
fn.pexp_attributes;
155-
{
156-
Parsetree.pexp_desc =
157-
Pexp_apply
158-
( fn,
159-
(Nolabel, bounded_obj_arg) :: args
160-
);
161-
pexp_attributes = [];
162-
pexp_loc = fn.pexp_loc;
163-
}
164-
| _ ->
165-
Ast_compatible.app1 ~loc:fn.pexp_loc fn
166-
bounded_obj_arg));
167-
pexp_attributes = tuple_attrs;
168-
pexp_loc = fn.pexp_loc;
169-
})
170-
| _ ->
135+
| Pexp_tuple xs ->
136+
bound new_obj_arg (fun bounded_obj_arg ->
171137
{
172-
(Ast_compatible.app1 ~loc fn new_obj_arg) with
173-
pexp_attributes = e.pexp_attributes;
174-
}))
138+
pexp_desc =
139+
Pexp_tuple
140+
(Ext_list.map xs (fun fn ->
141+
match fn.pexp_desc with
142+
| Pexp_construct (ctor, None) ->
143+
{
144+
fn with
145+
pexp_desc =
146+
Pexp_construct (ctor, Some bounded_obj_arg);
147+
}
148+
| Pexp_apply (fn, args) ->
149+
Bs_ast_invariant
150+
.warn_discarded_unused_attributes
151+
fn.pexp_attributes;
152+
{
153+
Parsetree.pexp_desc =
154+
Pexp_apply
155+
(fn, (Nolabel, bounded_obj_arg) :: args);
156+
pexp_attributes = [];
157+
pexp_loc = fn.pexp_loc;
158+
}
159+
| _ ->
160+
Ast_compatible.app1 ~loc:fn.pexp_loc fn
161+
bounded_obj_arg));
162+
pexp_attributes = fn.pexp_attributes;
163+
pexp_loc = fn.pexp_loc;
164+
})
165+
| _ ->
166+
Ast_compatible.app1 ~loc ~attrs:e.pexp_attributes fn new_obj_arg)
175167
| Some { op = "##"; loc; args = [ obj; rest ] } -> (
176168
(* - obj##property
177169
- obj#(method a b )

lib/4.06.1/unstable/js_compiler.ml

Lines changed: 31 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -269436,46 +269436,38 @@ let app_exp_mapper (e : exp) (self : Bs_ast_mapper.mapper) (fn : exp)
269436269436
pexp_loc = e.pexp_loc;
269437269437
pexp_attributes = e.pexp_attributes;
269438269438
}
269439-
| _ -> (
269440-
match fn with
269441-
| { pexp_desc = Pexp_tuple xs; pexp_attributes = tuple_attrs } ->
269442-
bound new_obj_arg (fun bounded_obj_arg ->
269443-
{
269444-
pexp_desc =
269445-
Pexp_tuple
269446-
(Ext_list.map xs (fun fn ->
269447-
match fn.pexp_desc with
269448-
| Pexp_construct (ctor, None) ->
269449-
{
269450-
fn with
269451-
pexp_desc =
269452-
Pexp_construct
269453-
(ctor, Some bounded_obj_arg);
269454-
}
269455-
| Pexp_apply (fn, args) ->
269456-
Bs_ast_invariant
269457-
.warn_discarded_unused_attributes
269458-
fn.pexp_attributes;
269459-
{
269460-
Parsetree.pexp_desc =
269461-
Pexp_apply
269462-
( fn,
269463-
(Nolabel, bounded_obj_arg) :: args
269464-
);
269465-
pexp_attributes = [];
269466-
pexp_loc = fn.pexp_loc;
269467-
}
269468-
| _ ->
269469-
Ast_compatible.app1 ~loc:fn.pexp_loc fn
269470-
bounded_obj_arg));
269471-
pexp_attributes = tuple_attrs;
269472-
pexp_loc = fn.pexp_loc;
269473-
})
269474-
| _ ->
269439+
| Pexp_tuple xs ->
269440+
bound new_obj_arg (fun bounded_obj_arg ->
269475269441
{
269476-
(Ast_compatible.app1 ~loc fn new_obj_arg) with
269477-
pexp_attributes = e.pexp_attributes;
269478-
}))
269442+
pexp_desc =
269443+
Pexp_tuple
269444+
(Ext_list.map xs (fun fn ->
269445+
match fn.pexp_desc with
269446+
| Pexp_construct (ctor, None) ->
269447+
{
269448+
fn with
269449+
pexp_desc =
269450+
Pexp_construct (ctor, Some bounded_obj_arg);
269451+
}
269452+
| Pexp_apply (fn, args) ->
269453+
Bs_ast_invariant
269454+
.warn_discarded_unused_attributes
269455+
fn.pexp_attributes;
269456+
{
269457+
Parsetree.pexp_desc =
269458+
Pexp_apply
269459+
(fn, (Nolabel, bounded_obj_arg) :: args);
269460+
pexp_attributes = [];
269461+
pexp_loc = fn.pexp_loc;
269462+
}
269463+
| _ ->
269464+
Ast_compatible.app1 ~loc:fn.pexp_loc fn
269465+
bounded_obj_arg));
269466+
pexp_attributes = fn.pexp_attributes;
269467+
pexp_loc = fn.pexp_loc;
269468+
})
269469+
| _ ->
269470+
Ast_compatible.app1 ~loc ~attrs:e.pexp_attributes fn new_obj_arg)
269479269471
| Some { op = "##"; loc; args = [ obj; rest ] } -> (
269480269472
(* - obj##property
269481269473
- obj#(method a b )

lib/4.06.1/unstable/js_playground_compiler.ml

Lines changed: 31 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -270899,46 +270899,38 @@ let app_exp_mapper (e : exp) (self : Bs_ast_mapper.mapper) (fn : exp)
270899270899
pexp_loc = e.pexp_loc;
270900270900
pexp_attributes = e.pexp_attributes;
270901270901
}
270902-
| _ -> (
270903-
match fn with
270904-
| { pexp_desc = Pexp_tuple xs; pexp_attributes = tuple_attrs } ->
270905-
bound new_obj_arg (fun bounded_obj_arg ->
270906-
{
270907-
pexp_desc =
270908-
Pexp_tuple
270909-
(Ext_list.map xs (fun fn ->
270910-
match fn.pexp_desc with
270911-
| Pexp_construct (ctor, None) ->
270912-
{
270913-
fn with
270914-
pexp_desc =
270915-
Pexp_construct
270916-
(ctor, Some bounded_obj_arg);
270917-
}
270918-
| Pexp_apply (fn, args) ->
270919-
Bs_ast_invariant
270920-
.warn_discarded_unused_attributes
270921-
fn.pexp_attributes;
270922-
{
270923-
Parsetree.pexp_desc =
270924-
Pexp_apply
270925-
( fn,
270926-
(Nolabel, bounded_obj_arg) :: args
270927-
);
270928-
pexp_attributes = [];
270929-
pexp_loc = fn.pexp_loc;
270930-
}
270931-
| _ ->
270932-
Ast_compatible.app1 ~loc:fn.pexp_loc fn
270933-
bounded_obj_arg));
270934-
pexp_attributes = tuple_attrs;
270935-
pexp_loc = fn.pexp_loc;
270936-
})
270937-
| _ ->
270902+
| Pexp_tuple xs ->
270903+
bound new_obj_arg (fun bounded_obj_arg ->
270938270904
{
270939-
(Ast_compatible.app1 ~loc fn new_obj_arg) with
270940-
pexp_attributes = e.pexp_attributes;
270941-
}))
270905+
pexp_desc =
270906+
Pexp_tuple
270907+
(Ext_list.map xs (fun fn ->
270908+
match fn.pexp_desc with
270909+
| Pexp_construct (ctor, None) ->
270910+
{
270911+
fn with
270912+
pexp_desc =
270913+
Pexp_construct (ctor, Some bounded_obj_arg);
270914+
}
270915+
| Pexp_apply (fn, args) ->
270916+
Bs_ast_invariant
270917+
.warn_discarded_unused_attributes
270918+
fn.pexp_attributes;
270919+
{
270920+
Parsetree.pexp_desc =
270921+
Pexp_apply
270922+
(fn, (Nolabel, bounded_obj_arg) :: args);
270923+
pexp_attributes = [];
270924+
pexp_loc = fn.pexp_loc;
270925+
}
270926+
| _ ->
270927+
Ast_compatible.app1 ~loc:fn.pexp_loc fn
270928+
bounded_obj_arg));
270929+
pexp_attributes = fn.pexp_attributes;
270930+
pexp_loc = fn.pexp_loc;
270931+
})
270932+
| _ ->
270933+
Ast_compatible.app1 ~loc ~attrs:e.pexp_attributes fn new_obj_arg)
270942270934
| Some { op = "##"; loc; args = [ obj; rest ] } -> (
270943270935
(* - obj##property
270944270936
- obj#(method a b )

lib/4.06.1/whole_compiler.ml

Lines changed: 31 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -281189,46 +281189,38 @@ let app_exp_mapper (e : exp) (self : Bs_ast_mapper.mapper) (fn : exp)
281189281189
pexp_loc = e.pexp_loc;
281190281190
pexp_attributes = e.pexp_attributes;
281191281191
}
281192-
| _ -> (
281193-
match fn with
281194-
| { pexp_desc = Pexp_tuple xs; pexp_attributes = tuple_attrs } ->
281195-
bound new_obj_arg (fun bounded_obj_arg ->
281196-
{
281197-
pexp_desc =
281198-
Pexp_tuple
281199-
(Ext_list.map xs (fun fn ->
281200-
match fn.pexp_desc with
281201-
| Pexp_construct (ctor, None) ->
281202-
{
281203-
fn with
281204-
pexp_desc =
281205-
Pexp_construct
281206-
(ctor, Some bounded_obj_arg);
281207-
}
281208-
| Pexp_apply (fn, args) ->
281209-
Bs_ast_invariant
281210-
.warn_discarded_unused_attributes
281211-
fn.pexp_attributes;
281212-
{
281213-
Parsetree.pexp_desc =
281214-
Pexp_apply
281215-
( fn,
281216-
(Nolabel, bounded_obj_arg) :: args
281217-
);
281218-
pexp_attributes = [];
281219-
pexp_loc = fn.pexp_loc;
281220-
}
281221-
| _ ->
281222-
Ast_compatible.app1 ~loc:fn.pexp_loc fn
281223-
bounded_obj_arg));
281224-
pexp_attributes = tuple_attrs;
281225-
pexp_loc = fn.pexp_loc;
281226-
})
281227-
| _ ->
281192+
| Pexp_tuple xs ->
281193+
bound new_obj_arg (fun bounded_obj_arg ->
281228281194
{
281229-
(Ast_compatible.app1 ~loc fn new_obj_arg) with
281230-
pexp_attributes = e.pexp_attributes;
281231-
}))
281195+
pexp_desc =
281196+
Pexp_tuple
281197+
(Ext_list.map xs (fun fn ->
281198+
match fn.pexp_desc with
281199+
| Pexp_construct (ctor, None) ->
281200+
{
281201+
fn with
281202+
pexp_desc =
281203+
Pexp_construct (ctor, Some bounded_obj_arg);
281204+
}
281205+
| Pexp_apply (fn, args) ->
281206+
Bs_ast_invariant
281207+
.warn_discarded_unused_attributes
281208+
fn.pexp_attributes;
281209+
{
281210+
Parsetree.pexp_desc =
281211+
Pexp_apply
281212+
(fn, (Nolabel, bounded_obj_arg) :: args);
281213+
pexp_attributes = [];
281214+
pexp_loc = fn.pexp_loc;
281215+
}
281216+
| _ ->
281217+
Ast_compatible.app1 ~loc:fn.pexp_loc fn
281218+
bounded_obj_arg));
281219+
pexp_attributes = fn.pexp_attributes;
281220+
pexp_loc = fn.pexp_loc;
281221+
})
281222+
| _ ->
281223+
Ast_compatible.app1 ~loc ~attrs:e.pexp_attributes fn new_obj_arg)
281232281224
| Some { op = "##"; loc; args = [ obj; rest ] } -> (
281233281225
(* - obj##property
281234281226
- obj#(method a b )

0 commit comments

Comments
 (0)