[HIR] fix missing read reference to switch test value

Unless I'm mistaken, the switch operand is missing here.
This commit is contained in:
Jan Kassens
2022-11-07 16:38:58 -05:00
parent 5d81fdeb5f
commit 7c094af34e
5 changed files with 5 additions and 4 deletions
@@ -641,6 +641,7 @@ function inferBlock(env: Environment, block: BasicBlock) {
break;
}
case "switch": {
env.reference(block.terminal.test, Effect.Read);
for (const case_ of block.terminal.cases) {
if (case_.test !== null) {
env.reference(case_.test, Effect.Read);
@@ -43,7 +43,7 @@ bb2:
[2] Const mutate $8 = 2
[3] Const mutate $9 = 1
[4] Const mutate $10 = 0
Switch (<unknown> props$6.test)
Switch (read props$6.test)
Case read $10: bb8
Case read $9: bb6
Case read $8: bb4
@@ -33,7 +33,7 @@ bb0:
[3] Const mutate $12 = Binary read x$10 === read $11
[4] Const mutate $13 = 1
[5] Const mutate $14 = Binary read x$10 === read $13
Switch (<unknown> x$10)
Switch (read x$10)
Case read $14: bb5
Case read $12: bb3
Default: bb2
@@ -37,7 +37,7 @@ bb0:
[3] Const mutate $12 = false
[4] Const mutate $13 = true
[5] Const mutate $14 = 1
Switch (<unknown> props$9.p0)
Switch (read props$9.p0)
Case read $14: bb1
Case read $13: bb6
Default: bb1
@@ -32,7 +32,7 @@ bb0:
[2] Let mutate y$10 = undefined
[3] Const mutate $11 = false
[4] Const mutate $12 = true
Switch (<unknown> props$8.p0)
Switch (read props$8.p0)
Case read $12: bb4
Case read $11: bb2
Default: bb1