dillon1000/react

Commit

[compiler] Remove local CompilerError accumulators, emit directly to env.recordError() (#35882)

Removes unnecessary indirection in 17 compiler passes that previously
accumulated errors in a local `CompilerError` instance before flushing
them to `env.recordErrors()` at the end of each pass. Errors are now
emitted directly via `env.recordError()` as they're discovered.

For passes with recursive error-detection patterns
(ValidateNoRefAccessInRender,
ValidateNoSetStateInRender), the internal accumulator is kept but
flushed
via individual `recordError()` calls. For InferMutationAliasingRanges,
a `shouldRecordErrors` flag preserves the conditional suppression logic.
For TransformFire, the throw-based error propagation is replaced with
direct recording plus an early-exit check in Pipeline.ts.

---
[//]: # (BEGIN SAPLING FOOTER)
Stack created with [Sapling](https://sapling-scm.com). Best reviewed
with [ReviewStack](https://reviewstack.dev/facebook/react/pull/35882).
* #35888
* #35884
* #35883
* __->__ #35882
Browse files
Changed paths16 files
First-parent comparison
M compiler/packages/babel-plugin-react-compiler/src/HIR/BuildHIR.ts ModifiedM compiler/packages/babel-plugin-react-compiler/src/HIR/HIRBuilder.ts ModifiedM compiler/packages/babel-plugin-react-compiler/src/Inference/DropManualMemoization.ts ModifiedM compiler/packages/babel-plugin-react-compiler/src/Inference/InferMutationAliasingRanges.ts ModifiedM compiler/packages/babel-plugin-react-compiler/src/ReactiveScopes/CodegenReactiveFunction.ts ModifiedM compiler/packages/babel-plugin-react-compiler/src/Validation/ValidateExhaustiveDependencies.ts ModifiedM compiler/packages/babel-plugin-react-compiler/src/Validation/ValidateHooksUsage.ts ModifiedM compiler/packages/babel-plugin-react-compiler/src/Validation/ValidateNoCapitalizedCalls.ts ModifiedM compiler/packages/babel-plugin-react-compiler/src/Validation/ValidateNoDerivedComputationsInEffects.ts ModifiedM compiler/packages/babel-plugin-react-compiler/src/Validation/ValidateNoFreezingKnownMutableFunctions.ts ModifiedM compiler/packages/babel-plugin-react-compiler/src/Validation/ValidateNoImpureFunctionsInRender.ts ModifiedM compiler/packages/babel-plugin-react-compiler/src/Validation/ValidateNoRefAccessInRender.ts ModifiedM compiler/packages/babel-plugin-react-compiler/src/Validation/ValidateNoSetStateInRender.ts ModifiedM compiler/packages/babel-plugin-react-compiler/src/Validation/ValidatePreservedManualMemoization.ts ModifiedM compiler/packages/babel-plugin-react-compiler/src/Validation/ValidateSourceLocations.ts ModifiedM compiler/packages/babel-plugin-react-compiler/src/Validation/ValidateUseMemo.ts Modified
Patch

Files changed

Rendering syntax-highlighted changes…