@@ -18823,7 +18823,7 @@ function printObjectPropertyKey(key) {
1882318823 }
1882418824}
1882518825function printInstructionValue(instrValue) {
18826- var _a, _b, _c, _d, _e, _f, _g ;
18826+ var _a, _b, _c, _d, _e;
1882718827 let value = '';
1882818828 switch (instrValue.kind) {
1882918829 case 'ArrayExpression': {
@@ -18996,18 +18996,8 @@ function printInstructionValue(instrValue) {
1899618996 const context = instrValue.loweredFunc.func.context
1899718997 .map(dep => printPlace(dep))
1899818998 .join(',');
18999- const effects = (_b = (_a = instrValue.loweredFunc.func.effects) === null || _a === void 0 ? void 0 : _a.map(effect => {
19000- if (effect.kind === 'ContextMutation') {
19001- return `ContextMutation places=[${[...effect.places]
19002- .map(place => printPlace(place))
19003- .join(', ')}] effect=${effect.effect}`;
19004- }
19005- else {
19006- return `GlobalMutation`;
19007- }
19008- }).join(', ')) !== null && _b !== void 0 ? _b : '';
19009- const aliasingEffects = (_e = (_d = (_c = instrValue.loweredFunc.func.aliasingEffects) === null || _c === void 0 ? void 0 : _c.map(printAliasingEffect)) === null || _d === void 0 ? void 0 : _d.join(', ')) !== null && _e !== void 0 ? _e : '';
19010- value = `${kind} ${name} @context[${context}] @effects[${effects}] @aliasingEffects=[${aliasingEffects}]\n${fn}`;
18999+ const aliasingEffects = (_c = (_b = (_a = instrValue.loweredFunc.func.aliasingEffects) === null || _a === void 0 ? void 0 : _a.map(printAliasingEffect)) === null || _b === void 0 ? void 0 : _b.join(', ')) !== null && _c !== void 0 ? _c : '';
19000+ value = `${kind} ${name} @context[${context}] @aliasingEffects=[${aliasingEffects}]\n${fn}`;
1901119001 break;
1901219002 }
1901319003 case 'TaggedTemplateExpression': {
@@ -19123,7 +19113,7 @@ function printInstructionValue(instrValue) {
1912319113 break;
1912419114 }
1912519115 case 'StartMemoize': {
19126- value = `StartMemoize deps=${(_g = (_f = instrValue.deps) === null || _f === void 0 ? void 0 : _f .map(dep => printManualMemoDependency(dep, false))) !== null && _g !== void 0 ? _g : '(none)'}`;
19116+ value = `StartMemoize deps=${(_e = (_d = instrValue.deps) === null || _d === void 0 ? void 0 : _d .map(dep => printManualMemoDependency(dep, false))) !== null && _e !== void 0 ? _e : '(none)'}`;
1912719117 break;
1912819118 }
1912919119 case 'FinishMemoize': {
@@ -48505,14 +48495,14 @@ function emitSelectorFn(env, keys) {
4850548495 returnTypeAnnotation: null,
4850648496 returns: createTemporaryPlace(env, GeneratedSource),
4850748497 context: [],
48508- effects: null,
4850948498 body: {
4851048499 entry: block.id,
4851148500 blocks: new Map([[block.id, block]]),
4851248501 },
4851348502 generator: false,
4851448503 async: false,
4851548504 directives: [],
48505+ aliasingEffects: [],
4851648506 };
4851748507 reversePostorderBlocks(fn.body);
4851848508 markInstructionIds(fn.body);
@@ -48937,14 +48927,14 @@ function emitOutlinedFn(env, jsx, oldProps, globals) {
4893748927 returnTypeAnnotation: null,
4893848928 returns: createTemporaryPlace(env, GeneratedSource),
4893948929 context: [],
48940- effects: null,
4894148930 body: {
4894248931 entry: block.id,
4894348932 blocks: new Map([[block.id, block]]),
4894448933 },
4894548934 generator: false,
4894648935 async: false,
4894748936 directives: [],
48937+ aliasingEffects: [],
4894848938 };
4894948939 return fn;
4895048940}
@@ -49601,14 +49591,13 @@ function validateStaticComponents(fn) {
4960149591}
4960249592
4960349593function validateNoFreezingKnownMutableFunctions(fn) {
49604- var _a;
4960549594 const errors = new CompilerError();
4960649595 const contextMutationEffects = new Map();
4960749596 function visitOperand(operand) {
4960849597 if (operand.effect === Effect.Freeze) {
4960949598 const effect = contextMutationEffects.get(operand.identifier.id);
4961049599 if (effect != null) {
49611- const place = [... effect.places][0] ;
49600+ const place = effect.value ;
4961249601 const variable = place != null &&
4961349602 place.identifier.name != null &&
4961449603 place.identifier.name.kind === 'named'
@@ -49626,7 +49615,7 @@ function validateNoFreezingKnownMutableFunctions(fn) {
4962649615 })
4962749616 .withDetail({
4962849617 kind: 'error',
49629- loc: effect.loc,
49618+ loc: effect.value. loc,
4963049619 message: `This modifies ${variable}`,
4963149620 }));
4963249621 }
@@ -49652,19 +49641,7 @@ function validateNoFreezingKnownMutableFunctions(fn) {
4965249641 break;
4965349642 }
4965449643 case 'FunctionExpression': {
49655- const knownMutation = ((_a = value.loweredFunc.func.effects) !== null && _a !== void 0 ? _a : []).find(effect => {
49656- return (effect.kind === 'ContextMutation' &&
49657- (effect.effect === Effect.Store ||
49658- effect.effect === Effect.Mutate) &&
49659- Iterable_some(effect.places, place => {
49660- return (isMutableEffect(place.effect, place.loc) &&
49661- !isRefOrRefLikeMutableType(place.identifier.type));
49662- }));
49663- });
49664- if (knownMutation && knownMutation.kind === 'ContextMutation') {
49665- contextMutationEffects.set(lvalue.identifier.id, knownMutation);
49666- }
49667- else if (value.loweredFunc.func.aliasingEffects != null) {
49644+ if (value.loweredFunc.func.aliasingEffects != null) {
4966849645 const context = new Set(value.loweredFunc.func.context.map(p => p.identifier.id));
4966949646 effects: for (const effect of value.loweredFunc.func
4967049647 .aliasingEffects) {
@@ -49677,12 +49654,7 @@ function validateNoFreezingKnownMutableFunctions(fn) {
4967749654 }
4967849655 else if (context.has(effect.value.identifier.id) &&
4967949656 !isRefOrRefLikeMutableType(effect.value.identifier.type)) {
49680- contextMutationEffects.set(lvalue.identifier.id, {
49681- kind: 'ContextMutation',
49682- effect: Effect.Mutate,
49683- loc: effect.value.loc,
49684- places: new Set([effect.value]),
49685- });
49657+ contextMutationEffects.set(lvalue.identifier.id, effect);
4968649658 break effects;
4968749659 }
4968849660 break;
0 commit comments