Add last-expression-return-value to functions as well

We did it for if and block statements, now functions too support the
last expression being its return value. If there isn't an expression
(e.g. an assign statement) we just return `nil`.

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
This commit is contained in:
2024-10-21 15:59:36 -07:00
parent 46c38de20c
commit 224533ea8a
5 changed files with 23 additions and 12 deletions

View File

@@ -243,7 +243,7 @@ GENERATE = [
"lparen: Token",
"params: Vec<(Token, Option<ExprP>)>",
"return_type: Option<ExprP>",
"body: Vec<StmtP>",
"body: BlockExpr",
"rbrace: Token",
],
)