update logic for Expr::TaskAwaitBang

This commit is contained in:
Luke Boswell 2024-04-27 12:35:53 +10:00
parent 7c53cf0cd7
commit 1640ee1321
No known key found for this signature in database
GPG key ID: F6DB3C9DB47377B0
4 changed files with 55 additions and 129 deletions

View file

@ -521,24 +521,6 @@ fn is_record_builder_field_suffixed(field: &RecordBuilderField<'_>) -> bool {
}
}
pub fn wrap_in_task_ok<'a>(arena: &'a Bump, loc_expr: &'a Loc<Expr<'a>>) -> &'a Loc<Expr<'a>> {
arena.alloc(Loc::at(
loc_expr.region,
Expr::Apply(
arena.alloc(Loc::at(
loc_expr.region,
Expr::Var {
module_name: ModuleName::TASK,
ident: "ok",
suffixed: 0,
},
)),
arena.alloc([loc_expr]),
CalledVia::BangSuffix,
),
))
}
pub fn split_around<T>(items: &[T], target: usize) -> (&[T], &[T]) {
let (before, rest) = items.split_at(target);
let after = &rest[1..];