-
Notifications
You must be signed in to change notification settings - Fork 38
Fix support for recursive components in JSX4 #733
Conversation
d9c2649
to
9220ef9
Compare
cli/reactjs_jsx_v4.ml
Outdated
@@ -1228,7 +1233,8 @@ let transformStructureItem ~config mapper item = | |||
List.fold_right otherStructures structuresAndBinding ([], [], []) | |||
in | |||
types | |||
@ [{pstr_loc; pstr_desc = Pstr_value (recFlag, bindings)}] | |||
(* No need to be Recursive as internal representation is called *) | |||
@ [{pstr_loc; pstr_desc = Pstr_value (Nonrecursive, bindings)}] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This does not work with mutually recursive components. See example in the original PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is removed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it works.
make(({}: props)) | ||
} | ||
let make = { | ||
let \"V4$Rec" = props => \"make$Internal"(props) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This part seems to be doing noting in the case of recursive functions.
That was true already before, so that's OK. Just, not very useful.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since recursive components are rare, let's just move on.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This part seems to be making this expression in js output:
function make(_props) {
while(true) {
_props = {};
continue ;
};
}
var V4$Rec = { // <- here
make: make
};
This PR fixes the issue rescript-lang/rescript#5981, backporting rescript-lang/rescript#5986 to syntax