mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-30 23:31:12 +00:00
add inc field to Inc instruction
This commit is contained in:
parent
5a2b2cbcac
commit
15cbadf652
6 changed files with 21 additions and 14 deletions
|
@ -766,7 +766,7 @@ pub enum Stmt<'a> {
|
|||
},
|
||||
Ret(Symbol),
|
||||
Rethrow,
|
||||
Inc(Symbol, &'a Stmt<'a>),
|
||||
Inc(Symbol, u64, &'a Stmt<'a>),
|
||||
Dec(Symbol, &'a Stmt<'a>),
|
||||
Join {
|
||||
id: JoinPointId,
|
||||
|
@ -1263,12 +1263,19 @@ impl<'a> Stmt<'a> {
|
|||
.append(alloc.intersperse(it, alloc.space()))
|
||||
.append(";")
|
||||
}
|
||||
Inc(symbol, cont) => alloc
|
||||
Inc(symbol, 1, cont) => alloc
|
||||
.text("inc ")
|
||||
.append(symbol_to_doc(alloc, *symbol))
|
||||
.append(";")
|
||||
.append(alloc.hardline())
|
||||
.append(cont.to_doc(alloc)),
|
||||
Inc(symbol, n, cont) => alloc
|
||||
.text("inc ")
|
||||
.append(alloc.text(format!("{}", n)))
|
||||
.append(symbol_to_doc(alloc, *symbol))
|
||||
.append(";")
|
||||
.append(alloc.hardline())
|
||||
.append(cont.to_doc(alloc)),
|
||||
Dec(symbol, cont) => alloc
|
||||
.text("dec ")
|
||||
.append(symbol_to_doc(alloc, *symbol))
|
||||
|
@ -4666,8 +4673,8 @@ fn substitute_in_stmt_help<'a>(
|
|||
Some(s) => Some(arena.alloc(Ret(s))),
|
||||
None => None,
|
||||
},
|
||||
Inc(symbol, cont) => match substitute_in_stmt_help(arena, cont, subs) {
|
||||
Some(cont) => Some(arena.alloc(Inc(*symbol, cont))),
|
||||
Inc(symbol, inc, cont) => match substitute_in_stmt_help(arena, cont, subs) {
|
||||
Some(cont) => Some(arena.alloc(Inc(*symbol, *inc, cont))),
|
||||
None => None,
|
||||
},
|
||||
Dec(symbol, cont) => match substitute_in_stmt_help(arena, cont, subs) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue