mirror of
https://github.com/roc-lang/roc.git
synced 2025-08-03 11:52:19 +00:00
consider expect in inc/dec
This commit is contained in:
parent
830dd03b30
commit
a671b57f83
2 changed files with 28 additions and 3 deletions
|
@ -1187,7 +1187,25 @@ impl<'a> Context<'a> {
|
|||
(switch, case_live_vars)
|
||||
}
|
||||
|
||||
Expect { remainder, .. } => self.visit_stmt(codegen, remainder),
|
||||
Expect {
|
||||
remainder,
|
||||
condition,
|
||||
region,
|
||||
lookups,
|
||||
layouts,
|
||||
} => {
|
||||
let (b, b_live_vars) = self.visit_stmt(codegen, remainder);
|
||||
|
||||
let expect = self.arena.alloc(Stmt::Expect {
|
||||
condition: *condition,
|
||||
region: *region,
|
||||
lookups,
|
||||
layouts,
|
||||
remainder: b,
|
||||
});
|
||||
|
||||
(expect, b_live_vars)
|
||||
}
|
||||
|
||||
RuntimeError(_) | Refcounting(_, _) => (stmt, MutSet::default()),
|
||||
}
|
||||
|
|
|
@ -1980,9 +1980,16 @@ impl<'a> Stmt<'a> {
|
|||
.append(alloc.hardline())
|
||||
.append(cont.to_doc(alloc)),
|
||||
|
||||
Expect { condition, .. } => alloc
|
||||
Expect {
|
||||
condition,
|
||||
remainder,
|
||||
..
|
||||
} => alloc
|
||||
.text("expect ")
|
||||
.append(symbol_to_doc(alloc, *condition)),
|
||||
.append(symbol_to_doc(alloc, *condition))
|
||||
.append(";")
|
||||
.append(alloc.hardline())
|
||||
.append(remainder.to_doc(alloc)),
|
||||
|
||||
Ret(symbol) => alloc
|
||||
.text("ret ")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue