@@ -19518,7 +19518,6 @@ function getFunctionName$2(instrValue, defaultValue) {
1951819518 }
1951919519}
1952019520function printAliasingEffect(effect) {
19521- var _a;
1952219521 switch (effect.kind) {
1952319522 case 'Assign': {
1952419523 return `Assign ${printPlaceForAliasEffect(effect.into)} = ${printPlaceForAliasEffect(effect.from)}`;
@@ -19577,7 +19576,7 @@ function printAliasingEffect(effect) {
1957719576 case 'MutateConditionally':
1957819577 case 'MutateTransitive':
1957919578 case 'MutateTransitiveConditionally': {
19580- return `${effect.kind} ${printPlaceForAliasEffect(effect.value)}${effect.kind === 'Mutate' && ((_a = effect.reason) === null || _a === void 0 ? void 0 : _a.kind) === 'AssignCurrentProperty' ? ' (assign `.current`)' : ''} `;
19579+ return `${effect.kind} ${printPlaceForAliasEffect(effect.value)}`;
1958119580 }
1958219581 case 'MutateFrozen': {
1958319582 return `MutateFrozen ${printPlaceForAliasEffect(effect.place)} reason=${JSON.stringify(effect.error.reason)}`;
@@ -21089,7 +21088,7 @@ class HIRBuilder {
2108921088 }
2109021089 }
2109121090 resolveBinding(node) {
21092- var _a, _b, _c ;
21091+ var _a, _b;
2109321092 if (node.name === 'fbt') {
2109421093 CompilerError.throwDiagnostic({
2109521094 severity: ErrorSeverity.Todo,
@@ -21105,21 +21104,6 @@ class HIRBuilder {
2110521104 ],
2110621105 });
2110721106 }
21108- if (node.name === 'this') {
21109- CompilerError.throwDiagnostic({
21110- severity: ErrorSeverity.UnsupportedJS,
21111- category: ErrorCategory.UnsupportedSyntax,
21112- reason: '`this` is not supported syntax',
21113- description: 'React Compiler does not support compiling functions that use `this`',
21114- details: [
21115- {
21116- kind: 'error',
21117- message: '`this` was used here',
21118- loc: (_b = node.loc) !== null && _b !== void 0 ? _b : GeneratedSource,
21119- },
21120- ],
21121- });
21122- }
2112321107 const originalName = node.name;
2112421108 let name = originalName;
2112521109 let index = 0;
@@ -21137,7 +21121,7 @@ class HIRBuilder {
2113721121 },
2113821122 scope: null,
2113921123 type: makeType(),
21140- loc: (_c = node.loc) !== null && _c !== void 0 ? _c : GeneratedSource,
21124+ loc: (_b = node.loc) !== null && _b !== void 0 ? _b : GeneratedSource,
2114121125 };
2114221126 __classPrivateFieldGet(this, _HIRBuilder_env, "f").programContext.addNewReference(name);
2114321127 __classPrivateFieldGet(this, _HIRBuilder_bindings, "f").set(name, { node, identifier });
@@ -42314,7 +42298,7 @@ class RewriteBlockIds extends ReactiveFunctionVisitor {
4231442298}
4231542299
4231642300function inferMutationAliasingRanges(fn, { isFunctionExpression }) {
42317- var _a, _b, _c, _d, _e, _f, _g ;
42301+ var _a, _b, _c, _d, _e, _f;
4231842302 const functionEffects = [];
4231942303 const state = new AliasingState();
4232042304 const pendingPhis = new Map();
@@ -42381,7 +42365,6 @@ function inferMutationAliasingRanges(fn, { isFunctionExpression }) {
4238142365 kind: effect.kind === 'MutateTransitive'
4238242366 ? MutationKind.Definite
4238342367 : MutationKind.Conditional,
42384- reason: null,
4238542368 place: effect.value,
4238642369 });
4238742370 }
@@ -42394,7 +42377,6 @@ function inferMutationAliasingRanges(fn, { isFunctionExpression }) {
4239442377 kind: effect.kind === 'Mutate'
4239542378 ? MutationKind.Definite
4239642379 : MutationKind.Conditional,
42397- reason: effect.kind === 'Mutate' ? ((_a = effect.reason) !== null && _a !== void 0 ? _a : null) : null,
4239842380 place: effect.value,
4239942381 });
4240042382 }
@@ -42436,7 +42418,7 @@ function inferMutationAliasingRanges(fn, { isFunctionExpression }) {
4243642418 }
4243742419 }
4243842420 for (const mutation of mutations) {
42439- state.mutate(mutation.index, mutation.place.identifier, makeInstructionId(mutation.id + 1), mutation.transitive, mutation.kind, mutation.place.loc, mutation.reason, errors);
42421+ state.mutate(mutation.index, mutation.place.identifier, makeInstructionId(mutation.id + 1), mutation.transitive, mutation.kind, mutation.place.loc, errors);
4244042422 }
4244142423 for (const render of renders) {
4244242424 state.render(render.index, render.place.identifier, errors);
@@ -42461,7 +42443,6 @@ function inferMutationAliasingRanges(fn, { isFunctionExpression }) {
4246142443 functionEffects.push({
4246242444 kind: 'Mutate',
4246342445 value: Object.assign(Object.assign({}, place), { loc: node.local.loc }),
42464- reason: node.mutationReason,
4246542446 });
4246642447 }
4246742448 }
@@ -42489,15 +42470,15 @@ function inferMutationAliasingRanges(fn, { isFunctionExpression }) {
4248942470 for (const phi of block.phis) {
4249042471 phi.place.effect = Effect.Store;
4249142472 const isPhiMutatedAfterCreation = phi.place.identifier.mutableRange.end >
42492- ((_c = (_b = block.instructions.at(0)) === null || _b === void 0 ? void 0 : _b .id) !== null && _c !== void 0 ? _c : block.terminal.id);
42473+ ((_b = (_a = block.instructions.at(0)) === null || _a === void 0 ? void 0 : _a .id) !== null && _b !== void 0 ? _b : block.terminal.id);
4249342474 for (const operand of phi.operands.values()) {
4249442475 operand.effect = isPhiMutatedAfterCreation
4249542476 ? Effect.Capture
4249642477 : Effect.Read;
4249742478 }
4249842479 if (isPhiMutatedAfterCreation &&
4249942480 phi.place.identifier.mutableRange.start === 0) {
42500- const firstInstructionIdOfBlock = (_e = (_d = block.instructions.at(0)) === null || _d === void 0 ? void 0 : _d .id) !== null && _e !== void 0 ? _e : block.terminal.id;
42481+ const firstInstructionIdOfBlock = (_d = (_c = block.instructions.at(0)) === null || _c === void 0 ? void 0 : _c .id) !== null && _d !== void 0 ? _d : block.terminal.id;
4250142482 phi.place.identifier.mutableRange.start = makeInstructionId(firstInstructionIdOfBlock - 1);
4250242483 }
4250342484 }
@@ -42575,15 +42556,15 @@ function inferMutationAliasingRanges(fn, { isFunctionExpression }) {
4257542556 }
4257642557 }
4257742558 for (const lvalue of eachInstructionLValue(instr)) {
42578- const effect = (_f = operandEffects.get(lvalue.identifier.id)) !== null && _f !== void 0 ? _f : Effect.ConditionallyMutate;
42559+ const effect = (_e = operandEffects.get(lvalue.identifier.id)) !== null && _e !== void 0 ? _e : Effect.ConditionallyMutate;
4257942560 lvalue.effect = effect;
4258042561 }
4258142562 for (const operand of eachInstructionValueOperand(instr.value)) {
4258242563 if (operand.identifier.mutableRange.end > instr.id &&
4258342564 operand.identifier.mutableRange.start === 0) {
4258442565 operand.identifier.mutableRange.start = instr.id;
4258542566 }
42586- const effect = (_g = operandEffects.get(operand.identifier.id)) !== null && _g !== void 0 ? _g : Effect.Read;
42567+ const effect = (_f = operandEffects.get(operand.identifier.id)) !== null && _f !== void 0 ? _f : Effect.Read;
4258742568 operand.effect = effect;
4258842569 }
4258942570 if (instr.value.kind === 'StoreContext' &&
@@ -42621,7 +42602,7 @@ function inferMutationAliasingRanges(fn, { isFunctionExpression }) {
4262142602 }
4262242603 for (const into of tracked) {
4262342604 const mutationIndex = index++;
42624- state.mutate(mutationIndex, into.identifier, null, true, MutationKind.Conditional, into.loc, null, ignoredErrors);
42605+ state.mutate(mutationIndex, into.identifier, null, true, MutationKind.Conditional, into.loc, ignoredErrors);
4262542606 for (const from of tracked) {
4262642607 if (from.identifier.id === into.identifier.id ||
4262742608 from.identifier.id === fn.returns.identifier.id) {
@@ -42689,7 +42670,6 @@ class AliasingState {
4268942670 transitive: null,
4269042671 local: null,
4269142672 lastMutated: 0,
42692- mutationReason: null,
4269342673 value,
4269442674 });
4269542675 }
@@ -42774,8 +42754,7 @@ class AliasingState {
4277442754 }
4277542755 }
4277642756 }
42777- mutate(index, start, end, transitive, startKind, loc, reason, errors) {
42778- var _a;
42757+ mutate(index, start, end, transitive, startKind, loc, errors) {
4277942758 const seen = new Map();
4278042759 const queue = [{ place: start, transitive, direction: 'backwards', kind: startKind }];
4278142760 while (queue.length !== 0) {
@@ -42789,7 +42768,6 @@ class AliasingState {
4278942768 if (node == null) {
4279042769 continue;
4279142770 }
42792- (_a = node.mutationReason) !== null && _a !== void 0 ? _a : (node.mutationReason = reason);
4279342771 node.lastMutated = Math.max(node.lastMutated, index);
4279442772 if (end != null) {
4279542773 node.id.mutableRange.end = makeInstructionId(Math.max(node.id.mutableRange.end, end));
0 commit comments