@samitouri / QOS-React / commits / 60137a8b64

[rhir][cleanup] remove DeclKind (replaced by pruneNonReactiveDependencies)

DeclKind is no longer read / needed due to pruneNonReactiveDependencies pass.

mofeiZ committed Feb 27, 2023 at 11:04 UTC 60137a8b6436df4eb6f2379cc90756a545b45134
1 file changed -10
compiler/forget/src/ReactiveScopes/PropagateScopeDependencies.ts
-10
@@ -34,14 +34,12 @@ export function propagateScopeDependencies(fn: ReactiveFunction): void {
34 const context = new Context();
35 if (fn.id !== null) {
36 context.declare(fn.id, {
37 - kind: DeclKind.Const,
37 id: makeInstructionId(0),
38 scope: null,
39 });
40 }
41 for (const param of fn.params) {
42 context.declare(param.identifier, {
44 - kind: DeclKind.Dynamic,
43 id: makeInstructionId(0),
44 scope: null,
45 });
@@ -49,14 +47,8 @@ export function propagateScopeDependencies(fn: ReactiveFunction): void {
47 visit(context, fn.body);
48 }
49
52 -enum DeclKind {
53 - Const = "Const",
54 - Dynamic = "Dynamic",
55 -}
56 -
50 type DeclMap = Map<IdentifierId, Decl>;
51 type Decl = {
59 - kind: DeclKind;
52 id: InstructionId;
53 scope: ReactiveScope | null;
54 };
@@ -193,7 +185,6 @@ class Context {
185 if (
186 currentScope != null &&
187 currentDeclaration !== undefined &&
196 - currentDeclaration.kind !== DeclKind.Const &&
188 currentDeclaration.id < currentScope.range.start &&
189 (currentDeclaration.scope == null ||
190 !this.#isScopeActive(currentDeclaration.scope))
@@ -402,7 +393,6 @@ function visitInstruction(context: Context, instr: ReactiveInstruction): void {
393 context.visitReassignment(lvalue);
394 }
395 context.declare(lvalue.place.identifier, {
405 - kind: DeclKind.Dynamic,
396 id: instr.id,
397 scope: context.currentScope,
398 });