ts2c
ts2c copied to clipboard
IIFE conversion?
let name = () => {
declarations;
return rvalue;
}()
to
type name;
{
declarations;
name = rvalue;
}
Thanks for the idea!
One thing though: if there are multiple returns inside IIFE, that makes things a bit ugly, because we would have to break from the block using goto in that case.
In overall, I think the idea is sound, but I would propose to only optimize simple IIFEs with that approach - ones that don't return values and don't have any return statements inside.