mirror of
https://github.com/roc-lang/roc.git
synced 2025-10-01 07:41:12 +00:00
Replace CallByName and CallPointer with Call
This commit is contained in:
parent
c72270ddf2
commit
b27893b5d9
2 changed files with 7 additions and 9 deletions
|
@ -40,8 +40,7 @@ pub enum Expr {
|
|||
Box<Located<Expr>>,
|
||||
),
|
||||
|
||||
CallByName(Symbol, Vec<Located<Expr>>, CalledVia),
|
||||
CallPointer(Box<Expr>, Vec<Located<Expr>>, CalledVia),
|
||||
Call(Box<Expr>, Vec<Located<Expr>>, CalledVia),
|
||||
|
||||
// Product Types
|
||||
Record(Variable, Vec<Located<(Box<str>, Located<Expr>)>>),
|
||||
|
|
|
@ -301,22 +301,21 @@ fn canonicalize_expr(
|
|||
// We're not tail-calling a symbol (by name), we're tail-calling a function value.
|
||||
output.tail_call = None;
|
||||
|
||||
let expr = match &fn_expr.value {
|
||||
&Var(_, ref sym) | &FunctionPointer(_, ref sym) => {
|
||||
let expr = match fn_expr.value {
|
||||
Var(_, ref sym) | FunctionPointer(_, ref sym) => {
|
||||
// In the FunctionPointer case, we're calling an inline closure;
|
||||
// something like ((\a b -> a + b) 1 2)
|
||||
// something like ((\a b -> a + b) 1 2).
|
||||
output.references.calls.insert(sym.clone());
|
||||
|
||||
CallByName(sym.clone(), args, *application_style)
|
||||
Call(Box::new(fn_expr.value), args, *application_style)
|
||||
}
|
||||
&RuntimeError(_) => {
|
||||
RuntimeError(_) => {
|
||||
// We can't call a runtime error; bail out by propagating it!
|
||||
return (fn_expr, output);
|
||||
}
|
||||
not_var => {
|
||||
// This could be something like ((if True then fn1 else fn2) arg1 arg2).
|
||||
// Use CallPointer here.
|
||||
panic!("TODO support function calls that aren't by name, via CallPointer, in this case: {:?}", not_var);
|
||||
Call(Box::new(not_var), args, *application_style)
|
||||
}
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue