mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-28 06:14:46 +00:00
rename Unreachable -> Rethrow
This commit is contained in:
parent
9dd02ea090
commit
e005dbde4c
5 changed files with 15 additions and 20 deletions
|
@ -1494,9 +1494,9 @@ pub fn build_exp_stmt<'a, 'ctx, 'env>(
|
||||||
call,
|
call,
|
||||||
layout,
|
layout,
|
||||||
pass,
|
pass,
|
||||||
fail: roc_mono::ir::Stmt::Unreachable,
|
fail: roc_mono::ir::Stmt::Rethrow,
|
||||||
} => {
|
} => {
|
||||||
// when the fail case is just Unreachable, there is no cleanup work to do
|
// when the fail case is just Rethrow, there is no cleanup work to do
|
||||||
// so we can just treat this invoke as a normal call
|
// so we can just treat this invoke as a normal call
|
||||||
let stmt =
|
let stmt =
|
||||||
roc_mono::ir::Stmt::Let(*symbol, Expr::Call(call.clone()), layout.clone(), pass);
|
roc_mono::ir::Stmt::Let(*symbol, Expr::Call(call.clone()), layout.clone(), pass);
|
||||||
|
@ -1561,7 +1561,7 @@ pub fn build_exp_stmt<'a, 'ctx, 'env>(
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
Unreachable => {
|
Rethrow => {
|
||||||
cxa_rethrow_exception(env);
|
cxa_rethrow_exception(env);
|
||||||
|
|
||||||
// used in exception handling
|
// used in exception handling
|
||||||
|
|
|
@ -170,7 +170,7 @@ impl<'a> ParamMap<'a> {
|
||||||
}
|
}
|
||||||
Inc(_, _) | Dec(_, _) => unreachable!("these have not been introduced yet"),
|
Inc(_, _) | Dec(_, _) => unreachable!("these have not been introduced yet"),
|
||||||
|
|
||||||
Ret(_) | Unreachable | Jump(_, _) | RuntimeError(_) => {
|
Ret(_) | Rethrow | Jump(_, _) | RuntimeError(_) => {
|
||||||
// these are terminal, do nothing
|
// these are terminal, do nothing
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -515,7 +515,7 @@ impl<'a> BorrowInfState<'a> {
|
||||||
}
|
}
|
||||||
Inc(_, _) | Dec(_, _) => unreachable!("these have not been introduced yet"),
|
Inc(_, _) | Dec(_, _) => unreachable!("these have not been introduced yet"),
|
||||||
|
|
||||||
Ret(_) | RuntimeError(_) | Unreachable => {
|
Ret(_) | RuntimeError(_) | Rethrow => {
|
||||||
// these are terminal, do nothing
|
// these are terminal, do nothing
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -50,7 +50,7 @@ pub fn occuring_variables(stmt: &Stmt<'_>) -> (MutSet<Symbol>, MutSet<Symbol>) {
|
||||||
result.insert(*symbol);
|
result.insert(*symbol);
|
||||||
}
|
}
|
||||||
|
|
||||||
Unreachable => {}
|
Rethrow => {}
|
||||||
|
|
||||||
Inc(symbol, cont) | Dec(symbol, cont) => {
|
Inc(symbol, cont) | Dec(symbol, cont) => {
|
||||||
result.insert(*symbol);
|
result.insert(*symbol);
|
||||||
|
@ -792,7 +792,7 @@ impl<'a> Context<'a> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Unreachable => (stmt, MutSet::default()),
|
Rethrow => (stmt, MutSet::default()),
|
||||||
|
|
||||||
Jump(j, xs) => {
|
Jump(j, xs) => {
|
||||||
let empty = MutSet::default();
|
let empty = MutSet::default();
|
||||||
|
@ -953,7 +953,7 @@ pub fn collect_stmt(
|
||||||
vars
|
vars
|
||||||
}
|
}
|
||||||
|
|
||||||
Unreachable => vars,
|
Rethrow => vars,
|
||||||
|
|
||||||
RuntimeError(_) => vars,
|
RuntimeError(_) => vars,
|
||||||
}
|
}
|
||||||
|
|
|
@ -762,7 +762,7 @@ pub enum Stmt<'a> {
|
||||||
ret_layout: Layout<'a>,
|
ret_layout: Layout<'a>,
|
||||||
},
|
},
|
||||||
Ret(Symbol),
|
Ret(Symbol),
|
||||||
Unreachable,
|
Rethrow,
|
||||||
Inc(Symbol, &'a Stmt<'a>),
|
Inc(Symbol, &'a Stmt<'a>),
|
||||||
Dec(Symbol, &'a Stmt<'a>),
|
Dec(Symbol, &'a Stmt<'a>),
|
||||||
Join {
|
Join {
|
||||||
|
@ -911,11 +911,6 @@ pub enum CallType<'a> {
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
// x = f a b c; S
|
|
||||||
//
|
|
||||||
//
|
|
||||||
// invoke x = f a b c in S else Unreachable
|
|
||||||
|
|
||||||
#[derive(Clone, Debug, PartialEq)]
|
#[derive(Clone, Debug, PartialEq)]
|
||||||
pub enum Expr<'a> {
|
pub enum Expr<'a> {
|
||||||
Literal(Literal<'a>),
|
Literal(Literal<'a>),
|
||||||
|
@ -1133,7 +1128,7 @@ impl<'a> Stmt<'a> {
|
||||||
symbol,
|
symbol,
|
||||||
call,
|
call,
|
||||||
pass,
|
pass,
|
||||||
fail: Stmt::Unreachable,
|
fail: Stmt::Rethrow,
|
||||||
..
|
..
|
||||||
} => alloc
|
} => alloc
|
||||||
.text("let ")
|
.text("let ")
|
||||||
|
@ -1166,7 +1161,7 @@ impl<'a> Stmt<'a> {
|
||||||
.append(symbol_to_doc(alloc, *symbol))
|
.append(symbol_to_doc(alloc, *symbol))
|
||||||
.append(";"),
|
.append(";"),
|
||||||
|
|
||||||
Unreachable => alloc.text("unreachable;"),
|
Rethrow => alloc.text("unreachable;"),
|
||||||
|
|
||||||
Switch {
|
Switch {
|
||||||
cond_symbol,
|
cond_symbol,
|
||||||
|
@ -4572,7 +4567,7 @@ fn substitute_in_stmt_help<'a>(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Unreachable => None,
|
Rethrow => None,
|
||||||
|
|
||||||
RuntimeError(_) => None,
|
RuntimeError(_) => None,
|
||||||
}
|
}
|
||||||
|
@ -5293,7 +5288,7 @@ fn build_call<'a>(
|
||||||
hole: &'a Stmt<'a>,
|
hole: &'a Stmt<'a>,
|
||||||
) -> Stmt<'a> {
|
) -> Stmt<'a> {
|
||||||
if can_throw_exception(&call) {
|
if can_throw_exception(&call) {
|
||||||
let fail = env.arena.alloc(Stmt::Unreachable);
|
let fail = env.arena.alloc(Stmt::Rethrow);
|
||||||
Stmt::Invoke {
|
Stmt::Invoke {
|
||||||
symbol: assigned,
|
symbol: assigned,
|
||||||
call,
|
call,
|
||||||
|
|
|
@ -102,7 +102,7 @@ fn insert_jumps<'a>(
|
||||||
pass: Stmt::Ret(rsym),
|
pass: Stmt::Ret(rsym),
|
||||||
..
|
..
|
||||||
} if needle == *fsym && symbol == rsym => {
|
} if needle == *fsym && symbol == rsym => {
|
||||||
debug_assert_eq!(fail, &&Stmt::Unreachable);
|
debug_assert_eq!(fail, &&Stmt::Rethrow);
|
||||||
|
|
||||||
// replace the call and return with a jump
|
// replace the call and return with a jump
|
||||||
|
|
||||||
|
@ -237,7 +237,7 @@ fn insert_jumps<'a>(
|
||||||
None => None,
|
None => None,
|
||||||
},
|
},
|
||||||
|
|
||||||
Unreachable => None,
|
Rethrow => None,
|
||||||
Ret(_) => None,
|
Ret(_) => None,
|
||||||
Jump(_, _) => None,
|
Jump(_, _) => None,
|
||||||
RuntimeError(_) => None,
|
RuntimeError(_) => None,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue