mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-30 07:14:46 +00:00
remove Invoke
This commit is contained in:
parent
19d56fa7d4
commit
194918fe4b
9 changed files with 15 additions and 532 deletions
|
@ -2198,7 +2198,6 @@ pub fn build_exp_stmt<'a, 'ctx, 'env>(
|
|||
parent: FunctionValue<'ctx>,
|
||||
stmt: &roc_mono::ir::Stmt<'a>,
|
||||
) -> BasicValueEnum<'ctx> {
|
||||
use roc_mono::ir::Expr;
|
||||
use roc_mono::ir::Stmt::*;
|
||||
|
||||
match stmt {
|
||||
|
@ -2259,48 +2258,6 @@ pub fn build_exp_stmt<'a, 'ctx, 'env>(
|
|||
value
|
||||
}
|
||||
|
||||
Invoke {
|
||||
symbol,
|
||||
call,
|
||||
layout,
|
||||
pass,
|
||||
fail: roc_mono::ir::Stmt::Resume(_),
|
||||
exception_id: _,
|
||||
} => {
|
||||
// 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
|
||||
let stmt = roc_mono::ir::Stmt::Let(*symbol, Expr::Call(call.clone()), *layout, pass);
|
||||
build_exp_stmt(env, layout_ids, func_spec_solutions, scope, parent, &stmt)
|
||||
}
|
||||
|
||||
Invoke {
|
||||
call, layout: _, ..
|
||||
} => match call.call_type {
|
||||
CallType::ByName { .. } => {
|
||||
unreachable!("we should not end up here")
|
||||
}
|
||||
|
||||
CallType::Foreign {
|
||||
ref foreign_symbol,
|
||||
ref ret_layout,
|
||||
} => build_foreign_symbol(env, scope, foreign_symbol, call.arguments, ret_layout),
|
||||
|
||||
CallType::LowLevel { .. } => {
|
||||
unreachable!("lowlevel itself never throws exceptions")
|
||||
}
|
||||
|
||||
CallType::HigherOrderLowLevel { .. } => {
|
||||
unreachable!("lowlevel itself never throws exceptions")
|
||||
}
|
||||
},
|
||||
|
||||
Resume(exception_id) => {
|
||||
let exception_object = scope.get(&exception_id.into_inner()).unwrap().1;
|
||||
env.builder.build_resume(exception_object);
|
||||
|
||||
env.ptr_int().const_zero().into()
|
||||
}
|
||||
|
||||
Switch {
|
||||
branches,
|
||||
default_branch,
|
||||
|
@ -6117,7 +6074,6 @@ fn throw_exception<'a, 'ctx, 'env>(env: &Env<'a, 'ctx, 'env>, message: &str) {
|
|||
)
|
||||
.into_pointer_value();
|
||||
|
||||
// cxa_throw_exception(env, info);
|
||||
env.call_panic(cast, PanicTagId::NullTerminatedString);
|
||||
|
||||
builder.build_unreachable();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue