27
} from '../HIR/visitors';
28
import {assertExhaustive, getOrInsertWith} from '../Utils/utils';
29
import {Err, Ok, Result} from '../Utils/Result';
30
-import {AliasingEffect} from './AliasingEffects';
30
+import {AliasingEffect, MutationReason} from './AliasingEffects';
31
32
/**
33
* This pass builds an abstract model of the heap and interprets the effects of the
101
transitive: boolean;
102
kind: MutationKind;
103
place: Place;
104
+ reason: MutationReason | null;
105
}> = [];
106
const renders: Array<{index: number; place: Place}> = [];
107
177
effect.kind === 'MutateTransitive'
178
? MutationKind.Definite
179
: MutationKind.Conditional,
180
+ reason: null,
181
place: effect.value,
182
});
183
} else if (
192
effect.kind === 'Mutate'
193
? MutationKind.Definite
194
: MutationKind.Conditional,
195
+ reason: effect.kind === 'Mutate' ? (effect.reason ?? null) : null,
196
place: effect.value,
197
});
198
} else if (
244
mutation.transitive,
245
mutation.kind,
246
mutation.place.loc,
247
+ mutation.reason,
248
errors,
249
);
250
}
271
functionEffects.push({
272
kind: 'Mutate',
273
value: {...place, loc: node.local.loc},
274
+ reason: node.mutationReason,
275
});
276
}
277
}
512
true,
513
MutationKind.Conditional,
514
into.loc,
515
+ null,
516
ignoredErrors,
517
);
518
for (const from of tracked) {
586
transitive: {kind: MutationKind; loc: SourceLocation} | null;
587
local: {kind: MutationKind; loc: SourceLocation} | null;
588
lastMutated: number;
589
+ mutationReason: MutationReason | null;
590
value:
591
| {kind: 'Object'}
592
| {kind: 'Phi'}
606
transitive: null,
607
local: null,
608
lastMutated: 0,
609
+ mutationReason: null,
610
value,
611
});
612
}
705
transitive: boolean,
706
startKind: MutationKind,
707
loc: SourceLocation,
708
+ reason: MutationReason | null,
709
errors: CompilerError,
710
): void {
711
const seen = new Map<Identifier, MutationKind>();
726
if (node == null) {
727
continue;
728
}
729
+ node.mutationReason ??= reason;
730
node.lastMutated = Math.max(node.lastMutated, index);
731
if (end != null) {
732
node.id.mutableRange.end = makeInstructionId(