Skip to content

Commit 16a42b7

Browse files
committed
fix pipe "-> eats up attrs in comprehensive cases
1 parent d5b55b5 commit 16a42b7

File tree

4 files changed

+12
-28
lines changed

4 files changed

+12
-28
lines changed

jscomp/frontend/ast_exp_apply.ml

+3-7
Original file line numberDiff line numberDiff line change
@@ -128,12 +128,6 @@ let app_exp_mapper (e : exp) (self : Bs_ast_mapper.mapper) (fn : exp)
128128
pexp_loc = e.pexp_loc;
129129
pexp_attributes = e.pexp_attributes;
130130
}
131-
| Pexp_ident _ ->
132-
{
133-
pexp_desc = Pexp_apply (fn, [ (Nolabel, new_obj_arg) ]);
134-
pexp_loc = e.pexp_loc;
135-
pexp_attributes = e.pexp_attributes;
136-
}
137131
| _ -> (
138132
match Ast_open_cxt.destruct fn [] with
139133
| ( { pexp_desc = Pexp_tuple xs; pexp_attributes = tuple_attrs },
@@ -186,7 +180,9 @@ let app_exp_mapper (e : exp) (self : Bs_ast_mapper.mapper) (fn : exp)
186180
pexp_attributes = [];
187181
pexp_loc = loc;
188182
}
189-
| _ -> Ast_compatible.app1 ~loc fn new_obj_arg))
183+
| _ ->
184+
Ast_compatible.app1 ~loc ~attrs:e.pexp_attributes fn
185+
new_obj_arg))
190186
| Some { op = "##"; loc; args = [ obj; rest ] } -> (
191187
(* - obj##property
192188
- obj#(method a b )

lib/4.06.1/unstable/js_compiler.ml

+3-7
Original file line numberDiff line numberDiff line change
@@ -269546,12 +269546,6 @@ let app_exp_mapper (e : exp) (self : Bs_ast_mapper.mapper) (fn : exp)
269546269546
pexp_loc = e.pexp_loc;
269547269547
pexp_attributes = e.pexp_attributes;
269548269548
}
269549-
| Pexp_ident _ ->
269550-
{
269551-
pexp_desc = Pexp_apply (fn, [ (Nolabel, new_obj_arg) ]);
269552-
pexp_loc = e.pexp_loc;
269553-
pexp_attributes = e.pexp_attributes;
269554-
}
269555269549
| _ -> (
269556269550
match Ast_open_cxt.destruct fn [] with
269557269551
| ( { pexp_desc = Pexp_tuple xs; pexp_attributes = tuple_attrs },
@@ -269604,7 +269598,9 @@ let app_exp_mapper (e : exp) (self : Bs_ast_mapper.mapper) (fn : exp)
269604269598
pexp_attributes = [];
269605269599
pexp_loc = loc;
269606269600
}
269607-
| _ -> Ast_compatible.app1 ~loc fn new_obj_arg))
269601+
| _ ->
269602+
Ast_compatible.app1 ~loc ~attrs:e.pexp_attributes fn
269603+
new_obj_arg))
269608269604
| Some { op = "##"; loc; args = [ obj; rest ] } -> (
269609269605
(* - obj##property
269610269606
- obj#(method a b )

lib/4.06.1/unstable/js_playground_compiler.ml

+3-7
Original file line numberDiff line numberDiff line change
@@ -271009,12 +271009,6 @@ let app_exp_mapper (e : exp) (self : Bs_ast_mapper.mapper) (fn : exp)
271009271009
pexp_loc = e.pexp_loc;
271010271010
pexp_attributes = e.pexp_attributes;
271011271011
}
271012-
| Pexp_ident _ ->
271013-
{
271014-
pexp_desc = Pexp_apply (fn, [ (Nolabel, new_obj_arg) ]);
271015-
pexp_loc = e.pexp_loc;
271016-
pexp_attributes = e.pexp_attributes;
271017-
}
271018271012
| _ -> (
271019271013
match Ast_open_cxt.destruct fn [] with
271020271014
| ( { pexp_desc = Pexp_tuple xs; pexp_attributes = tuple_attrs },
@@ -271067,7 +271061,9 @@ let app_exp_mapper (e : exp) (self : Bs_ast_mapper.mapper) (fn : exp)
271067271061
pexp_attributes = [];
271068271062
pexp_loc = loc;
271069271063
}
271070-
| _ -> Ast_compatible.app1 ~loc fn new_obj_arg))
271064+
| _ ->
271065+
Ast_compatible.app1 ~loc ~attrs:e.pexp_attributes fn
271066+
new_obj_arg))
271071271067
| Some { op = "##"; loc; args = [ obj; rest ] } -> (
271072271068
(* - obj##property
271073271069
- obj#(method a b )

lib/4.06.1/whole_compiler.ml

+3-7
Original file line numberDiff line numberDiff line change
@@ -281299,12 +281299,6 @@ let app_exp_mapper (e : exp) (self : Bs_ast_mapper.mapper) (fn : exp)
281299281299
pexp_loc = e.pexp_loc;
281300281300
pexp_attributes = e.pexp_attributes;
281301281301
}
281302-
| Pexp_ident _ ->
281303-
{
281304-
pexp_desc = Pexp_apply (fn, [ (Nolabel, new_obj_arg) ]);
281305-
pexp_loc = e.pexp_loc;
281306-
pexp_attributes = e.pexp_attributes;
281307-
}
281308281302
| _ -> (
281309281303
match Ast_open_cxt.destruct fn [] with
281310281304
| ( { pexp_desc = Pexp_tuple xs; pexp_attributes = tuple_attrs },
@@ -281357,7 +281351,9 @@ let app_exp_mapper (e : exp) (self : Bs_ast_mapper.mapper) (fn : exp)
281357281351
pexp_attributes = [];
281358281352
pexp_loc = loc;
281359281353
}
281360-
| _ -> Ast_compatible.app1 ~loc fn new_obj_arg))
281354+
| _ ->
281355+
Ast_compatible.app1 ~loc ~attrs:e.pexp_attributes fn
281356+
new_obj_arg))
281361281357
| Some { op = "##"; loc; args = [ obj; rest ] } -> (
281362281358
(* - obj##property
281363281359
- obj#(method a b )

0 commit comments

Comments
 (0)