Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import {
IdentifierName,
LoweredFunction,
Place,
ReactiveScopeDependency,
isRefOrRefValue,
makeInstructionId,
} from '../HIR';
Expand All @@ -25,9 +24,14 @@ import {inferMutableContextVariables} from './InferMutableContextVariables';
import {inferMutableRanges} from './InferMutableRanges';
import inferReferenceEffects from './InferReferenceEffects';

type Dependency = {
identifier: Identifier;
path: Array<string>;
};

// Helper class to track indirections such as LoadLocal and PropertyLoad.
export class IdentifierState {
properties: Map<Identifier, ReactiveScopeDependency> = new Map();
properties: Map<Identifier, Dependency> = new Map();

resolve(identifier: Identifier): Identifier {
const resolved = this.properties.get(identifier);
Expand All @@ -39,7 +43,7 @@ export class IdentifierState {

declareProperty(lvalue: Place, object: Place, property: string): void {
const objectDependency = this.properties.get(object.identifier);
let nextDependency: ReactiveScopeDependency;
let nextDependency: Dependency;
if (objectDependency === undefined) {
nextDependency = {identifier: object.identifier, path: [property]};
} else {
Expand All @@ -52,9 +56,7 @@ export class IdentifierState {
}

declareTemporary(lvalue: Place, value: Place): void {
const resolved: ReactiveScopeDependency = this.properties.get(
value.identifier,
) ?? {
const resolved: Dependency = this.properties.get(value.identifier) ?? {
identifier: value.identifier,
path: [],
};
Expand Down