@samitouri / QOS-React / commits / d43a5014f4

Rename ReactiveScope.outputs to ReactiveScope.declarations

Lauren Tan committed Feb 8, 2023 at 10:26 UTC d43a5014f4ffa76251178dfac9e32c699c598d75
7 files changed +8 -8
compiler/forget/src/HIR/HIR.ts
+1 -1
@@ -555,7 +555,7 @@ export type ReactiveScope = {
555 id: ScopeId;
556 range: MutableRange;
557 dependencies: Set<ReactiveScopeDependency>;
558 - outputs: Set<Identifier>;
558 + declarations: Set<Identifier>;
559 };
560
561 export type ReactiveScopeDependency = {
compiler/forget/src/ReactiveScopes/CodegenReactiveFunction.ts
+1 -1
@@ -179,7 +179,7 @@ function codegenReactiveScope(
179 );
180 }
181 let firstOutputIndex: number | null = null;
182 - for (const output of scope.outputs) {
182 + for (const output of scope.declarations) {
183 const index = cx.nextCacheIndex;
184 if (firstOutputIndex === null) {
185 firstOutputIndex = index;
compiler/forget/src/ReactiveScopes/InferReactiveScopeVariables.ts
+1 -1
@@ -128,7 +128,7 @@ export function inferReactiveScopeVariables(fn: HIRFunction) {
128 id: makeScopeId(scopes.size),
129 range: identifier.mutableRange,
130 dependencies: new Set(),
131 - outputs: new Set(),
131 + declarations: new Set(),
132 };
133 scopes.set(groupIdentifier, scope);
134 } else {
compiler/forget/src/ReactiveScopes/PrintReactiveFunction.ts
+2 -2
@@ -43,9 +43,9 @@ export function printReactiveBlock(
43 writer.writeLine(
44 `scope @${block.scope.id} [${block.scope.range.start}:${
45 block.scope.range.end
46 - }] deps=[${Array.from(block.scope.dependencies)
46 + }] dependencies=[${Array.from(block.scope.dependencies)
47 .map((dep) => printDependency(dep))
48 - .join(", ")}] out=[${Array.from(block.scope.outputs)
48 + .join(", ")}] declarations=[${Array.from(block.scope.declarations)
49 .map((out) => printIdentifier(out))
50 .join(", ")}] {`
51 );
compiler/forget/src/ReactiveScopes/PromoteUsedTemporaries.ts
+1 -1
@@ -25,7 +25,7 @@ class Visitor extends ReactiveFunctionVisitor<VisitorState> {
25 // value.
26 // Many of our current test fixtures do not return a value, so
27 // it is better for now to promote (and memoize) every output.
28 - for (const identifier of block.scope.outputs) {
28 + for (const identifier of block.scope.declarations) {
29 if (identifier.name == null) {
30 identifier.name = `t${state.nextId++}`;
31 }
compiler/forget/src/ReactiveScopes/PropagateScopeDependencies.ts
+1 -1
@@ -153,7 +153,7 @@ class Context {
153 if (decl !== undefined) {
154 const operandScope = maybeDependency.place.identifier.scope;
155 if (operandScope !== null && !this.#isScopeActive(operandScope)) {
156 - operandScope.outputs.add(maybeDependency.place.identifier);
156 + operandScope.declarations.add(maybeDependency.place.identifier);
157 }
158 }
159
compiler/forget/src/ReactiveScopes/PruneUnusedScopes.ts
+1 -1
@@ -30,7 +30,7 @@ function visitBlock(block: ReactiveBlock): ReactiveBlock {
30 }
31 case "scope": {
32 stmt.instructions = visitBlock(stmt.instructions);
33 - if (stmt.scope.outputs.size === 0) {
33 + if (stmt.scope.declarations.size === 0) {
34 nextBlock ??= block.slice(0, i);
35 nextBlock.push(...stmt.instructions);
36 continue;