dillon1000/react
Commit
Browse files [patch] Fix for constant propagation bug in VR Store
---
Changes in `@enableOptimizeFunctionExpressions` caused a bug in the last Forget
sync to VR Store. The repro can be summarized to something like this:
```js
function foo() {
const x = true; // some constant or global
// Add some branching for type inference
// This can be a Logical expression as well (e.g. `4 || 5`)
if (...) { }
// In this HIR block, SSA inserts a `x$2 = phi(x$1, x$1)`.
// EliminateRedundantPhiNodes needs to rewrite all references of `x$2` to `x$1`
const accessXInLambda = () => x;
return accessXInLambda;
}Changed paths4 files
First-parent comparisoncompiler/forget/packages/babel-plugin-react-forget/src/SSA/EliminateRedundantPhi.ts ModifiedA compiler/forget/packages/babel-plugin-react-forget/src/__tests__/e2e/constant-prop.e2e.js AddedA compiler/forget/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/rewrite-phis-in-lambda-capture-context.expect.md AddedA compiler/forget/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/rewrite-phis-in-lambda-capture-context.js AddedPatch
Files changed
Rendering syntax-highlighted changes…