mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-28 22:34:45 +00:00
Implement the try
keyword with desugaring
This commit is contained in:
parent
69dd8d77f3
commit
308defac46
9 changed files with 196 additions and 10 deletions
|
@ -1132,6 +1132,11 @@ pub fn canonicalize_expr<'a>(
|
|||
ast::Expr::TrySuffix { .. } => internal_error!(
|
||||
"a Expr::TrySuffix expression was not completely removed in desugar_value_def_suffixed"
|
||||
),
|
||||
ast::Expr::Try => {
|
||||
// Treat remaining `try` keywords as normal variables so that we can continue to support `Result.try`
|
||||
canonicalize_var_lookup(env, var_store, scope, "", "try", region)
|
||||
}
|
||||
|
||||
ast::Expr::Tag(tag) => {
|
||||
let variant_var = var_store.fresh();
|
||||
let ext_var = var_store.fresh();
|
||||
|
@ -2547,6 +2552,7 @@ pub fn is_valid_interpolation(expr: &ast::Expr<'_>) -> bool {
|
|||
| ast::Expr::RecordUpdater(_)
|
||||
| ast::Expr::Crash
|
||||
| ast::Expr::Dbg
|
||||
| ast::Expr::Try
|
||||
| ast::Expr::Underscore(_)
|
||||
| ast::Expr::MalformedIdent(_, _)
|
||||
| ast::Expr::Tag(_)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue