@samitouri / QOS-React-1 / commits / 03874a29b3

Repro for needing function body rewriting in ReactiveFunction phase

Adds an example demonstrating why we need the ability to rewrite parts of a ReactiveFunction into a function expression. Here, the reactive scope needs to contain an `if` terminal, but we can't put a ReactiveIfTerminal inside a function expression, since that expects HIR. There are two main paths forward: * Use HIR everywhere. I wrote this up and we're all agreed, it's just a bunch of work. * Add an alternative FunctionExpression variant to ReactiveFunction For now i'm going to take the second route.

Joe Savona committed Feb 16, 2024 at 14:58 UTC 03874a29b388c7a5accd153a8c62c8c449fce62d
1 file changed +1 -1
compiler/packages/babel-plugin-react-forget/src/Inference/InferAliasForPhis.ts
+1 -1
@@ -17,7 +17,7 @@ export function inferAliasForPhis(
17 const isPhiMutatedAfterCreation: boolean =
18 phi.id.mutableRange.end >
19 (block.instructions.at(0)?.id ?? block.terminal.id);
20 - if (isPhiMutatedAfterCreation) {
20 + if (isPhiMutatedAfterCreation || func.env.config.enableForest) {
21 for (const [, operand] of phi.operands) {
22 aliases.union([phi.id, operand]);
23 }