Rename ReactiveScope.outputs to ReactiveScope.declarations

This commit is contained in:
Lauren Tan
2023-02-08 10:26:27 -05:00
parent 1809ffd06d
commit d43a5014f4
7 changed files with 8 additions and 8 deletions
+1 -1
View File
@@ -555,7 +555,7 @@ export type ReactiveScope = {
id: ScopeId;
range: MutableRange;
dependencies: Set<ReactiveScopeDependency>;
outputs: Set<Identifier>;
declarations: Set<Identifier>;
};
export type ReactiveScopeDependency = {
@@ -179,7 +179,7 @@ function codegenReactiveScope(
);
}
let firstOutputIndex: number | null = null;
for (const output of scope.outputs) {
for (const output of scope.declarations) {
const index = cx.nextCacheIndex;
if (firstOutputIndex === null) {
firstOutputIndex = index;
@@ -128,7 +128,7 @@ export function inferReactiveScopeVariables(fn: HIRFunction) {
id: makeScopeId(scopes.size),
range: identifier.mutableRange,
dependencies: new Set(),
outputs: new Set(),
declarations: new Set(),
};
scopes.set(groupIdentifier, scope);
} else {
@@ -43,9 +43,9 @@ export function printReactiveBlock(
writer.writeLine(
`scope @${block.scope.id} [${block.scope.range.start}:${
block.scope.range.end
}] deps=[${Array.from(block.scope.dependencies)
}] dependencies=[${Array.from(block.scope.dependencies)
.map((dep) => printDependency(dep))
.join(", ")}] out=[${Array.from(block.scope.outputs)
.join(", ")}] declarations=[${Array.from(block.scope.declarations)
.map((out) => printIdentifier(out))
.join(", ")}] {`
);
@@ -25,7 +25,7 @@ class Visitor extends ReactiveFunctionVisitor<VisitorState> {
// value.
// Many of our current test fixtures do not return a value, so
// it is better for now to promote (and memoize) every output.
for (const identifier of block.scope.outputs) {
for (const identifier of block.scope.declarations) {
if (identifier.name == null) {
identifier.name = `t${state.nextId++}`;
}
@@ -153,7 +153,7 @@ class Context {
if (decl !== undefined) {
const operandScope = maybeDependency.place.identifier.scope;
if (operandScope !== null && !this.#isScopeActive(operandScope)) {
operandScope.outputs.add(maybeDependency.place.identifier);
operandScope.declarations.add(maybeDependency.place.identifier);
}
}
@@ -30,7 +30,7 @@ function visitBlock(block: ReactiveBlock): ReactiveBlock {
}
case "scope": {
stmt.instructions = visitBlock(stmt.instructions);
if (stmt.scope.outputs.size === 0) {
if (stmt.scope.declarations.size === 0) {
nextBlock ??= block.slice(0, i);
nextBlock.push(...stmt.instructions);
continue;