Skip to content

Commit

Permalink
[compiler][cleanup] Delete now-unused reactive scope fork
Browse files Browse the repository at this point in the history
Followup to #30891

ghstack-source-id: 6b42055b5d28da39d99a235bcd86a82eb7c270f4
Pull Request resolved: #30892
  • Loading branch information
mofeiZ committed Sep 6, 2024
1 parent 43264a6 commit 7b98a16
Show file tree
Hide file tree
Showing 11 changed files with 20 additions and 929 deletions.
17 changes: 16 additions & 1 deletion compiler/packages/babel-plugin-react-compiler/src/HIR/HIR.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1492,6 +1492,7 @@ export type ReactiveScopeDeclaration = {
scope: ReactiveScope; // the scope in which the variable was originally declared
};

export type DependencyPath = Array<{property: string; optional: boolean}>;
export type ReactiveScopeDependency = {
identifier: Identifier;
path: DependencyPath;
Expand All @@ -1506,7 +1507,21 @@ export function areEqualPaths(a: DependencyPath, b: DependencyPath): boolean {
)
);
}
export type DependencyPath = Array<{property: string; optional: boolean}>;

export function getPlaceScope(
id: InstructionId,
place: Place,
): ReactiveScope | null {
const scope = place.identifier.scope;
if (scope !== null && isScopeActive(scope, id)) {
return scope;
}
return null;
}

function isScopeActive(scope: ReactiveScope, id: InstructionId): boolean {
return id >= scope.range.start && id < scope.range.end;
}

/*
* Simulated opaque type for BlockIds to prevent using normal numbers as block ids
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
ReactiveScope,
makeInstructionId,
} from '.';
import {getPlaceScope} from '../ReactiveScopes/BuildReactiveBlocks';
import {getPlaceScope} from '../HIR/HIR';
import {isMutable} from '../ReactiveScopes/InferReactiveScopeVariables';
import DisjointSet from '../Utils/DisjointSet';
import {getOrInsertDefault} from '../Utils/utils';
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import {
MutableRange,
Place,
ReactiveScope,
getPlaceScope,
makeInstructionId,
} from '../HIR/HIR';
import {
Expand All @@ -23,7 +24,6 @@ import {
terminalFallthrough,
} from '../HIR/visitors';
import {retainWhere_Set} from '../Utils/utils';
import {getPlaceScope} from './BuildReactiveBlocks';

type InstructionRange = MutableRange;
/*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {
ReactiveScopeBlock,
ScopeId,
} from '../HIR';
import {getPlaceScope} from './BuildReactiveBlocks';
import {getPlaceScope} from '../HIR/HIR';
import {ReactiveFunctionVisitor} from './visitors';

/*
Expand Down
Loading

0 comments on commit 7b98a16

Please sign in to comment.