mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-27 13:59:08 +00:00
Implement return keyword
This commit is contained in:
parent
20a539a96d
commit
b3e60f9d3a
39 changed files with 594 additions and 80 deletions
|
@ -214,6 +214,7 @@ impl CompletionVisitor<'_> {
|
|||
DeclarationInfo::Value {
|
||||
expr_var, pattern, ..
|
||||
} => self.patterns(pattern, expr_var),
|
||||
DeclarationInfo::Return { .. } => vec![],
|
||||
DeclarationInfo::Function {
|
||||
expr_var,
|
||||
pattern,
|
||||
|
|
|
@ -641,6 +641,7 @@ impl IterTokens for ValueDef<'_> {
|
|||
onetoken(Token::Import, import.name.item.region, arena)
|
||||
}
|
||||
ValueDef::Stmt(loc_expr) => loc_expr.iter_tokens(arena),
|
||||
ValueDef::Return(loc_expr) => loc_expr.iter_tokens(arena),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -718,6 +719,11 @@ impl IterTokens for Loc<Expr<'_>> {
|
|||
Expr::When(e, branches) => (e.iter_tokens(arena).into_iter())
|
||||
.chain(branches.iter_tokens(arena))
|
||||
.collect_in(arena),
|
||||
Expr::Return(ret_expr, after_ret) => ret_expr
|
||||
.iter_tokens(arena)
|
||||
.into_iter()
|
||||
.chain(after_ret.iter_tokens(arena))
|
||||
.collect_in(arena),
|
||||
Expr::SpaceBefore(e, _) | Expr::SpaceAfter(e, _) => {
|
||||
Loc::at(region, *e).iter_tokens(arena)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue