Skip to content

Commit d5b55b5

Browse files
committed
fix pipe "->" eats up attrs in 1 arity fn
1 parent faa9510 commit d5b55b5

File tree

5 files changed

+33
-2
lines changed

5 files changed

+33
-2
lines changed

jscomp/frontend/ast_exp_apply.ml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,12 @@ 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+
}
131137
| _ -> (
132138
match Ast_open_cxt.destruct fn [] with
133139
| ( { pexp_desc = Pexp_tuple xs; pexp_attributes = tuple_attrs },

jscomp/test/res_debug.js

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,15 @@ function identity(x) {
5353
return x;
5454
}
5555

56-
var ok1 = {};
56+
var name1 = "ReScript";
5757

58-
var bad1 = {};
58+
var ok1 = {
59+
name: name1
60+
};
61+
62+
var bad1 = {
63+
name: name1
64+
};
5965

6066
var v2 = newrecord;
6167

@@ -82,6 +88,7 @@ exports.name = name;
8288
exports.ok = ok;
8389
exports.bad = bad;
8490
exports.identity = identity;
91+
exports.name1 = name1;
8592
exports.ok1 = ok1;
8693
exports.bad1 = bad1;
8794
/* Not a pure module */

lib/4.06.1/unstable/js_compiler.ml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -269546,6 +269546,12 @@ 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+
}
269549269555
| _ -> (
269550269556
match Ast_open_cxt.destruct fn [] with
269551269557
| ( { pexp_desc = Pexp_tuple xs; pexp_attributes = tuple_attrs },

lib/4.06.1/unstable/js_playground_compiler.ml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -271009,6 +271009,12 @@ 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+
}
271012271018
| _ -> (
271013271019
match Ast_open_cxt.destruct fn [] with
271014271020
| ( { pexp_desc = Pexp_tuple xs; pexp_attributes = tuple_attrs },

lib/4.06.1/whole_compiler.ml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -281299,6 +281299,12 @@ 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+
}
281302281308
| _ -> (
281303281309
match Ast_open_cxt.destruct fn [] with
281304281310
| ( { pexp_desc = Pexp_tuple xs; pexp_attributes = tuple_attrs },

0 commit comments

Comments
 (0)