mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-30 15:21:12 +00:00
parse expect
This commit is contained in:
parent
50942325b9
commit
700e7d9686
12 changed files with 223 additions and 5 deletions
|
@ -1489,6 +1489,8 @@ fn to_pending_def<'a>(
|
|||
}
|
||||
}
|
||||
|
||||
Expect(_condition) => todo!(),
|
||||
|
||||
SpaceBefore(sub_def, _) | SpaceAfter(sub_def, _) => {
|
||||
to_pending_def(env, var_store, sub_def, scope, pattern_type)
|
||||
}
|
||||
|
|
|
@ -649,6 +649,7 @@ pub fn canonicalize_expr<'a>(
|
|||
Output::default(),
|
||||
)
|
||||
}
|
||||
ast::Expr::Expect(_condition, _continuation) => todo!(),
|
||||
ast::Expr::If(if_thens, final_else_branch) => {
|
||||
let mut branches = Vec::with_capacity(1);
|
||||
let mut output = Output::default();
|
||||
|
|
|
@ -107,6 +107,10 @@ pub fn desugar_def<'a>(arena: &'a Bump, def: &'a Def<'a>) -> Def<'a> {
|
|||
body_pattern: *body_pattern,
|
||||
body_expr: desugar_expr(arena, body_expr),
|
||||
},
|
||||
Expect(condition) => {
|
||||
let desugared_condition = &*arena.alloc(desugar_expr(arena, condition));
|
||||
Expect(desugared_condition)
|
||||
}
|
||||
NotYetImplemented(s) => todo!("{}", s),
|
||||
}
|
||||
}
|
||||
|
@ -356,6 +360,14 @@ pub fn desugar_expr<'a>(arena: &'a Bump, loc_expr: &'a Located<Expr<'a>>) -> &'a
|
|||
region: loc_expr.region,
|
||||
})
|
||||
}
|
||||
Expect(condition, continuation) => {
|
||||
let desugared_condition = &*arena.alloc(desugar_expr(arena, &condition));
|
||||
let desugared_continuation = &*arena.alloc(desugar_expr(arena, &continuation));
|
||||
arena.alloc(Located {
|
||||
value: Expect(desugared_condition, desugared_continuation),
|
||||
region: loc_expr.region,
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue