mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-26 13:29:12 +00:00
ignore def pattern for function args
This commit is contained in:
parent
9fcd5a3fe8
commit
ce6e21ff7a
3 changed files with 37 additions and 8 deletions
|
@ -194,7 +194,7 @@ pub fn desugar_defs_node_values<'a>(
|
|||
/// For each top-level ValueDef in our module, we will unwrap any suffixed
|
||||
/// expressions
|
||||
///
|
||||
/// e.g. `say! "hi"` desugars to `Task.await (say "hi") -> \{} -> ...`
|
||||
/// e.g. `say! "hi"` desugars to `Task.await (say "hi") \{} -> ...`
|
||||
pub fn desugar_value_def_suffixed<'a>(arena: &'a Bump, value_def: ValueDef<'a>) -> ValueDef<'a> {
|
||||
use ValueDef::*;
|
||||
|
||||
|
|
|
@ -267,16 +267,13 @@ pub fn unwrap_suffixed_expression_apply_help<'a>(
|
|||
// Any suffixed arguments will be innermost, therefore we unwrap those first
|
||||
let local_args = arena.alloc_slice_copy(apply_args);
|
||||
for arg in local_args.iter_mut() {
|
||||
match unwrap_suffixed_expression(arena, arg, maybe_def_pat) {
|
||||
// Args are always expressions, don't pass `maybe_def_pat`
|
||||
match unwrap_suffixed_expression(arena, arg, None) {
|
||||
Ok(new_arg) => {
|
||||
*arg = new_arg;
|
||||
}
|
||||
Err(EUnwrapped::UnwrappedDefExpr(unwrapped_arg)) => {
|
||||
*arg = unwrapped_arg;
|
||||
|
||||
let new_apply = arena.alloc(Loc::at(loc_expr.region, Apply(function, local_args, called_via)));
|
||||
|
||||
return Err(EUnwrapped::UnwrappedDefExpr(new_apply));
|
||||
Err(EUnwrapped::UnwrappedDefExpr(_)) => {
|
||||
return Err(EUnwrapped::Malformed)
|
||||
}
|
||||
Err(EUnwrapped::UnwrappedSubExpr { sub_arg, sub_pat, sub_new: new_arg }) => {
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue