React Compiler: three review traps

One strip from the original three-strip run: gating chooses a function, but it also changes a named declaration into a const initializer. Read the transcript for the source-backed boundary.

Complete comic images, including dialogue and code labels, come from a generative image model. Open a transcript for source evidence.

Source revision: 575477a2e8f9db57ef4a1bf0d3b449e4f8244af8 · compiler/packages/babel-plugin-react-compiler/src/Entrypoint/Program.ts:782–846 · compiler/packages/babel-plugin-react-compiler/src/Entrypoint/Gating.ts:12–49 · compiler/packages/babel-plugin-react-compiler/src/Entrypoint/Program.ts:216–269 · compiler/packages/babel-plugin-react-compiler/src/Entrypoint/Program.ts:300–341

CODE UNPACKED · COMIC 1

The flag moved the floor

The flag moved the floor. Panel 1: compileProgram stick figure points at a stage labeled function declaration. A small arrow labeled call before declaration reaches the stage. Panel 2: Gating.ts stick figure replaces the stage with a platform labeled const and two doors labeled compiled and original. Panel 3: compileProgram stops a call arrow at a barrier before the const platform. The Gating figure holds a small checklist.
Transcript and source evidence
What this leaves out: Metaphor for named-declaration gating. Default exports and function expressions have different replacement forms; this is not a complete treatment of JavaScript hoisting.
Who is who

compileProgram — Entrypoint/Program.ts: selection, compilation and replacement
compiler/packages/babel-plugin-react-compiler/src/Entrypoint/Program.ts:216–269 · compiler/packages/babel-plugin-react-compiler/src/Entrypoint/Program.ts:300–341

Gating.ts — Builds the conditional compiled/original function expression
compiler/packages/babel-plugin-react-compiler/src/Entrypoint/Gating.ts:12–49

Source coverage limitations