@@ -33,9 +33,7 @@ import {findContextIdentifiers} from '../HIR/FindContextIdentifiers';
3333import {
3434 analyseFunctions ,
3535 dropManualMemoization ,
36- inferMutableRanges ,
3736 inferReactivePlaces ,
38- inferReferenceEffects ,
3937 inlineImmediatelyInvokedFunctionExpressions ,
4038 inferEffectDependencies ,
4139} from '../Inference' ;
@@ -101,7 +99,6 @@ import {outlineJSX} from '../Optimization/OutlineJsx';
10199import { optimizePropsMethodCalls } from '../Optimization/OptimizePropsMethodCalls' ;
102100import { transformFire } from '../Transform' ;
103101import { validateNoImpureFunctionsInRender } from '../Validation/ValidateNoImpureFunctionsInRender' ;
104- import { CompilerError } from '..' ;
105102import { validateStaticComponents } from '../Validation/ValidateStaticComponents' ;
106103import { validateNoFreezingKnownMutableFunctions } from '../Validation/ValidateNoFreezingKnownMutableFunctions' ;
107104import { inferMutationAliasingEffects } from '../Inference/InferMutationAliasingEffects' ;
@@ -229,28 +226,14 @@ function runWithEnvironment(
229226 analyseFunctions ( hir ) ;
230227 log ( { kind : 'hir' , name : 'AnalyseFunctions' , value : hir } ) ;
231228
232- if ( ! env . config . enableNewMutationAliasingModel ) {
233- const fnEffectErrors = inferReferenceEffects ( hir ) ;
234- if ( env . isInferredMemoEnabled ) {
235- if ( fnEffectErrors . length > 0 ) {
236- CompilerError . throw ( fnEffectErrors [ 0 ] ) ;
237- }
238- }
239- log ( { kind : 'hir' , name : 'InferReferenceEffects' , value : hir } ) ;
240- } else {
241- const mutabilityAliasingErrors = inferMutationAliasingEffects ( hir ) ;
242- log ( { kind : 'hir' , name : 'InferMutationAliasingEffects' , value : hir } ) ;
243- if ( env . isInferredMemoEnabled ) {
244- if ( mutabilityAliasingErrors . isErr ( ) ) {
245- throw mutabilityAliasingErrors . unwrapErr ( ) ;
246- }
229+ const mutabilityAliasingErrors = inferMutationAliasingEffects ( hir ) ;
230+ log ( { kind : 'hir' , name : 'InferMutationAliasingEffects' , value : hir } ) ;
231+ if ( env . isInferredMemoEnabled ) {
232+ if ( mutabilityAliasingErrors . isErr ( ) ) {
233+ throw mutabilityAliasingErrors . unwrapErr ( ) ;
247234 }
248235 }
249236
250- if ( ! env . config . enableNewMutationAliasingModel ) {
251- validateLocalsNotReassignedAfterRender ( hir ) ;
252- }
253-
254237 // Note: Has to come after infer reference effects because "dead" code may still affect inference
255238 deadCodeElimination ( hir ) ;
256239 log ( { kind : 'hir' , name : 'DeadCodeElimination' , value : hir } ) ;
@@ -263,20 +246,15 @@ function runWithEnvironment(
263246 pruneMaybeThrows ( hir ) ;
264247 log ( { kind : 'hir' , name : 'PruneMaybeThrows' , value : hir } ) ;
265248
266- if ( ! env . config . enableNewMutationAliasingModel ) {
267- inferMutableRanges ( hir ) ;
268- log ( { kind : 'hir' , name : 'InferMutableRanges' , value : hir } ) ;
269- } else {
270- const mutabilityAliasingErrors = inferMutationAliasingRanges ( hir , {
271- isFunctionExpression : false ,
272- } ) ;
273- log ( { kind : 'hir' , name : 'InferMutationAliasingRanges' , value : hir } ) ;
274- if ( env . isInferredMemoEnabled ) {
275- if ( mutabilityAliasingErrors . isErr ( ) ) {
276- throw mutabilityAliasingErrors . unwrapErr ( ) ;
277- }
278- validateLocalsNotReassignedAfterRender ( hir ) ;
249+ const mutabilityAliasingRangeErrors = inferMutationAliasingRanges ( hir , {
250+ isFunctionExpression : false ,
251+ } ) ;
252+ log ( { kind : 'hir' , name : 'InferMutationAliasingRanges' , value : hir } ) ;
253+ if ( env . isInferredMemoEnabled ) {
254+ if ( mutabilityAliasingRangeErrors . isErr ( ) ) {
255+ throw mutabilityAliasingRangeErrors . unwrapErr ( ) ;
279256 }
257+ validateLocalsNotReassignedAfterRender ( hir ) ;
280258 }
281259
282260 if ( env . isInferredMemoEnabled ) {
@@ -304,12 +282,7 @@ function runWithEnvironment(
304282 validateNoImpureFunctionsInRender ( hir ) . unwrap ( ) ;
305283 }
306284
307- if (
308- env . config . validateNoFreezingKnownMutableFunctions ||
309- env . config . enableNewMutationAliasingModel
310- ) {
311- validateNoFreezingKnownMutableFunctions ( hir ) . unwrap ( ) ;
312- }
285+ validateNoFreezingKnownMutableFunctions ( hir ) . unwrap ( ) ;
313286 }
314287
315288 inferReactivePlaces ( hir ) ;
0 commit comments