Skip to content

Commit f283c68

Browse files
committed
[compiler] Remove local CompilerError accumulators, emit directly to env.recordError()
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.
1 parent 6163309 commit f283c68

23 files changed

Lines changed: 817 additions & 684 deletions

compiler/packages/babel-plugin-react-compiler/src/Entrypoint/Pipeline.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,9 @@ function runWithEnvironment(
220220
if (env.config.enableFire) {
221221
transformFire(hir);
222222
log({kind: 'hir', name: 'TransformFire', value: hir});
223+
if (env.hasErrors()) {
224+
return Err(env.aggregateErrors());
225+
}
223226
}
224227

225228
if (env.config.lowerContextAccess) {

0 commit comments

Comments
 (0)