Skip to content

Commit

Permalink
[compiler] Clean up deadcode: ReactiveFunctionValue
Browse files Browse the repository at this point in the history
Summary:

Test Plan:

Reviewers:

Subscribers:

Tasks:

Tags:
  • Loading branch information
mofeiZ committed Jan 16, 2025
1 parent daaf493 commit 0eab0fe
Show file tree
Hide file tree
Showing 6 changed files with 1 addition and 55 deletions.
11 changes: 1 addition & 10 deletions compiler/packages/babel-plugin-react-compiler/src/HIR/HIR.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,16 +108,7 @@ export type ReactiveValue =
| ReactiveLogicalValue
| ReactiveSequenceValue
| ReactiveTernaryValue
| ReactiveOptionalCallValue
| ReactiveFunctionValue;

export type ReactiveFunctionValue = {
kind: 'ReactiveFunctionValue';
fn: ReactiveFunction;
dependencies: Array<Place>;
returnType: t.FlowType | t.TSType | null;
loc: SourceLocation;
};
| ReactiveOptionalCallValue;

export type ReactiveLogicalValue = {
kind: 'LogicalExpression';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -701,10 +701,6 @@ export function printInstructionValue(instrValue: ReactiveValue): string {
value = `FinishMemoize decl=${printPlace(instrValue.decl)}`;
break;
}
case 'ReactiveFunctionValue': {
value = `FunctionValue ${printReactiveFunction(instrValue.fn)}`;
break;
}
default: {
assertExhaustive(
instrValue,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2231,7 +2231,6 @@ function codegenInstructionValue(
);
break;
}
case 'ReactiveFunctionValue':
case 'StartMemoize':
case 'FinishMemoize':
case 'Debugger':
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -772,14 +772,6 @@ function computeMemoizationInputs(
rvalues: operands,
};
}
case 'ReactiveFunctionValue': {
CompilerError.invariant(false, {
reason: `Unexpected ReactiveFunctionValue node`,
description: null,
loc: value.loc,
suggestions: null,
});
}
case 'UnsupportedNode': {
CompilerError.invariant(false, {
reason: `Unexpected unsupported node`,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,15 +73,6 @@ export class ReactiveFunctionVisitor<TState = void> {
this.visitValue(value.id, value.value, state);
break;
}
case 'ReactiveFunctionValue': {
this.visitReactiveFunctionValue(
id,
value.dependencies,
value.fn,
state,
);
break;
}
default: {
for (const place of eachInstructionValueOperand(value)) {
this.visitPlace(id, place, state);
Expand Down Expand Up @@ -434,18 +425,6 @@ export class ReactiveFunctionTransform<
}
break;
}
case 'ReactiveFunctionValue': {
const nextValue = this.transformReactiveFunctionValue(
id,
value.dependencies,
value.fn,
state,
);
if (nextValue.kind === 'replace') {
value.fn = nextValue.value;
}
break;
}
default: {
for (const place of eachInstructionValueOperand(value)) {
this.visitPlace(id, place, state);
Expand Down Expand Up @@ -619,10 +598,6 @@ export function* eachReactiveValueOperand(
yield* eachReactiveValueOperand(instrValue.alternate);
break;
}
case 'ReactiveFunctionValue': {
yield* instrValue.dependencies;
break;
}
default: {
yield* eachInstructionValueOperand(instrValue);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -327,13 +327,6 @@ class Visitor extends ReactiveFunctionVisitor<VisitorState> {
case 'OptionalExpression': {
return this.recordDepsInValue(value.value, state);
}
case 'ReactiveFunctionValue': {
CompilerError.throwTodo({
reason:
'Handle ReactiveFunctionValue in ValidatePreserveManualMemoization',
loc: value.loc,
});
}
case 'ConditionalExpression': {
this.recordDepsInValue(value.test, state);
this.recordDepsInValue(value.consequent, state);
Expand Down

0 comments on commit 0eab0fe

Please sign in to comment.