dillon1000/react
Commit
Browse files Constant propagation for globals
This PR updates ConstantPropagation to support propagating global references: ```javascript // Before const x = Math; foo(x); // After foo(Math); ``` This is a generally useful optimization but also helps with a subset of cases around JSX element tags, which are frequently globals.
Changed paths4 files
First-parent comparisoncompiler/forget/src/HIR/HIR.ts ModifiedM compiler/forget/src/Optimization/ConstantPropagation.ts ModifiedM compiler/forget/src/__tests__/fixtures/compiler/infer-global-object.expect.md ModifiedM compiler/forget/src/__tests__/fixtures/compiler/useRef-rename-mutable.expect.md ModifiedPatch
Files changed
Rendering syntax-highlighted changes…