@@ -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' ;
@@ -100,7 +98,6 @@ import {outlineJSX} from '../Optimization/OutlineJsx';
10098import { optimizePropsMethodCalls } from '../Optimization/OptimizePropsMethodCalls' ;
10199import { transformFire } from '../Transform' ;
102100import { validateNoImpureFunctionsInRender } from '../Validation/ValidateNoImpureFunctionsInRender' ;
103- import { CompilerError } from '..' ;
104101import { validateStaticComponents } from '../Validation/ValidateStaticComponents' ;
105102import { validateNoFreezingKnownMutableFunctions } from '../Validation/ValidateNoFreezingKnownMutableFunctions' ;
106103import { 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 ) {
@@ -308,12 +286,7 @@ function runWithEnvironment(
308286 validateNoImpureFunctionsInRender ( hir ) . unwrap ( ) ;
309287 }
310288
311- if (
312- env . config . validateNoFreezingKnownMutableFunctions ||
313- env . config . enableNewMutationAliasingModel
314- ) {
315- validateNoFreezingKnownMutableFunctions ( hir ) . unwrap ( ) ;
316- }
289+ validateNoFreezingKnownMutableFunctions ( hir ) . unwrap ( ) ;
317290 }
318291
319292 inferReactivePlaces ( hir ) ;
0 commit comments