Skip to content

Commit 7c0af6e

Browse files
committed
Exploring problem space
1 parent 70a73ed commit 7c0af6e

File tree

5 files changed

+51
-2
lines changed

5 files changed

+51
-2
lines changed

compiler/syntax/src/jsx_v4.ml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1185,7 +1185,7 @@ let map_binding ~config ~empty_loc ~pstr_loc ~file_name ~rec_flag binding =
11851185
in
11861186
(Some props_record_type, binding, new_binding))
11871187
else if Jsx_common.has_attr_on_binding Jsx_common.has_attr_with_props binding
1188-
then
1188+
then (
11891189
let modified_binding =
11901190
{
11911191
binding with
@@ -1198,6 +1198,8 @@ let map_binding ~config ~empty_loc ~pstr_loc ~file_name ~rec_flag binding =
11981198
make_module_name file_name config.nested_modules fn_name
11991199
in
12001200

1201+
Format.printf "Yow %s\n" full_module_name;
1202+
12011203
let is_async =
12021204
Ast_async.dig_async_payload_from_function modified_binding.pvb_expr
12031205
in
@@ -1283,7 +1285,7 @@ let map_binding ~config ~empty_loc ~pstr_loc ~file_name ~rec_flag binding =
12831285
binding with
12841286
pvb_attributes = binding.pvb_attributes |> List.filter other_attrs_pure;
12851287
},
1286-
new_binding )
1288+
new_binding ))
12871289
else (None, binding, None)
12881290

12891291
let transform_structure_item ~config item =

tests/syntax_tests/data/ppx/react/expected/sharedPropsWithProps.res.txt

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,3 +131,17 @@ module V4A6 = {
131131
\"SharedPropsWithProps$V4A6"
132132
}
133133
}
134+
135+
module V4A7 = {
136+
type props = {count: int}
137+
138+
let make =
139+
@directive("'use memo'")
140+
props => {
141+
React.int(props.count)
142+
}
143+
let make = {
144+
let \"SharedPropsWithProps$V4A7" = props => make(props)
145+
\"SharedPropsWithProps$V4A7"
146+
}
147+
}

tests/syntax_tests/data/ppx/react/sharedPropsWithProps.res

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,3 +91,13 @@ module V4A6 = {
9191
}
9292
}
9393
}
94+
95+
module V4A7 = {
96+
type props = {count: int}
97+
98+
@react.componentWithProps
99+
let make = @directive("'use memo'")
100+
props => {
101+
React.int(props.count)
102+
}
103+
}

tests/tests/src/alias_default_value_test.mjs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,17 @@ let C7 = {
8282
make: Alias_default_value_test$C7
8383
};
8484

85+
function make(props) {
86+
'use memo';
87+
return props.count;
88+
}
89+
90+
let Alias_default_value_test$C8 = make;
91+
92+
let C8 = {
93+
make: Alias_default_value_test$C8
94+
};
95+
8596
export {
8697
C0,
8798
C1,
@@ -90,5 +101,6 @@ export {
90101
C4,
91102
C6,
92103
C7,
104+
C8,
93105
}
94106
/* No side effect */

tests/tests/src/alias_default_value_test.res

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,3 +64,14 @@ module C7 = {
6464
React.string(`Hello ${name}, you clicked me ` ++ times)
6565
}
6666
}
67+
68+
module C8 = {
69+
type props = {count: int}
70+
71+
@react.componentWithProps
72+
let make =
73+
@directive("'use memo'")
74+
props => {
75+
React.int(props.count)
76+
}
77+
}

0 commit comments

Comments
 (0)