99
const objectDependency = this.#properties.get(resolvedObject.identifier);
100
let nextDependency: ReactiveScopeDependency;
101
if (objectDependency === undefined) {
102
- nextDependency = { place: resolvedObject, path: [property] };
102
+ nextDependency = {
103
+ identifier: resolvedObject.identifier,
104
+ path: [property],
105
+ };
106
} else {
107
nextDependency = {
105
- place: objectDependency.place,
108
+ identifier: objectDependency.identifier,
109
path: [...(objectDependency.path ?? []), property],
110
};
111
}
122
123
visitOperand(place: Place): void {
124
const resolved = this.#temporaries.get(place.identifier) ?? place;
122
- this.visitDependency({ place: resolved, path: null });
125
+ this.visitDependency({ identifier: resolved.identifier, path: null });
126
}
127
128
visitProperty(object: Place, property: string): void {
130
const objectDependency = this.#properties.get(resolvedObject.identifier);
131
let nextDependency: ReactiveScopeDependency;
132
if (objectDependency === undefined) {
130
- nextDependency = { place: resolvedObject, path: [property] };
133
+ nextDependency = {
134
+ identifier: resolvedObject.identifier,
135
+ path: [property],
136
+ };
137
} else {
138
nextDependency = {
133
- place: objectDependency.place,
139
+ identifier: objectDependency.identifier,
140
path: [...(objectDependency.path ?? []), property],
141
};
142
}
152
} else {
153
// Otherwise if this operand is a temporary created for a property load, resolve it to
154
// the expanded Place. Fall back to using the operand as-is.
149
- let propDep = this.#properties.get(dependency.place.identifier);
150
- if (dependency.place.identifier.name === null && propDep !== undefined) {
155
+ let propDep = this.#properties.get(dependency.identifier);
156
+ if (dependency.identifier.name === null && propDep !== undefined) {
157
maybeDependency = propDep;
158
} else {
159
maybeDependency = dependency;
169
// if originalDeclaration is undefined here, then this is a free var
170
// (all other decls e.g. `let x;` should be initialized in BuildHIR)
171
const originalDeclaration = this.#declarations.get(
166
- maybeDependency.place.identifier.id
172
+ maybeDependency.identifier.id
173
);
174
if (
175
originalDeclaration !== undefined &&
177
!this.#isScopeActive(originalDeclaration.scope)
178
) {
179
originalDeclaration.scope.declarations.set(
174
- maybeDependency.place.identifier.id,
175
- maybeDependency.place.identifier
180
+ maybeDependency.identifier.id,
181
+ maybeDependency.identifier
182
);
183
}
184
185
// If this operand is used in a scope, has a dynamic value, and was defined
186
// before this scope, then its a dependency of the scope.
187
const currentDeclaration =
182
- this.#reassignments.get(maybeDependency.place.identifier) ??
183
- this.#declarations.get(maybeDependency.place.identifier.id);
188
+ this.#reassignments.get(maybeDependency.identifier) ??
189
+ this.#declarations.get(maybeDependency.identifier.id);
190
const currentScope = this.currentScope;
191
if (
192
currentScope != null &&
201
// Check if there is an existing dependency that describes this operand
202
for (const dep of this.#dependencies) {
203
// not the same identifier
198
- if (dep.place.identifier.id !== maybeDependency.place.identifier.id) {
204
+ if (dep.identifier.id !== maybeDependency.identifier.id) {
205
continue;
206
}
207
const depPath = dep.path ?? [];