[hir] Try to resolve a dep into a property load only if it's a temporary.

This commit is contained in:
Sathya Gunasekaran
2023-01-26 16:40:07 -05:00
parent 978215eae6
commit 41e8088e8c
3 changed files with 8 additions and 4 deletions
@@ -110,8 +110,12 @@ class Context {
} else {
// Otherwise if this operand is a temporary created for a property load, resolve it to
// the expanded Place. Fall back to using the operand as-is.
maybeDependency =
this.#properties.get(dependency.place.identifier) ?? dependency;
let propDep = this.#properties.get(dependency.place.identifier);
if (dependency.place.identifier.name === null && propDep !== undefined) {
maybeDependency = propDep;
} else {
maybeDependency = dependency;
}
}
const decl = this.#declarations.get(maybeDependency.place.identifier);
@@ -16,11 +16,11 @@ function component(t) {
function component(t) {
const $ = React.useMemoCache();
const a = t.a;
const c_0 = $[0] !== t6.a;
const c_0 = $[0] !== a;
let y;
if (c_0) {
y = { a: a };
$[0] = t6.a;
$[0] = a;
$[1] = y;
} else {
y = $[1];