mirror of
https://github.com/Noratrieb/dilaria.git
synced 2026-01-15 18:05:03 +01:00
fix return error
This commit is contained in:
parent
53c2cdb085
commit
131229686a
3 changed files with 22 additions and 9 deletions
|
|
@ -19,7 +19,7 @@ pub fn run_program(program: &str) {
|
|||
let ast = parse::parse(tokens);
|
||||
|
||||
match ast {
|
||||
Ok(ast) => println!("{:#?}", ast),
|
||||
Ok(ast) => println!("{:?}", ast),
|
||||
Err(err) => errors::display_error(program, err),
|
||||
}
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -103,7 +103,11 @@ impl<'code> Parser<'code> {
|
|||
let keyword_span = self.expect(TokenType::Fn)?.span;
|
||||
let name = self.ident()?;
|
||||
let args = self.fn_args()?;
|
||||
|
||||
self.inside_fn_depth += 1;
|
||||
let body = self.block()?;
|
||||
self.inside_fn_depth -= 1;
|
||||
|
||||
Ok(Stmt::FnDecl(FnDecl {
|
||||
span: keyword_span.extend(body.span),
|
||||
name,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue