This commit is contained in:
uan
2026-02-05 22:43:01 +01:00
parent 1581ca4928
commit a1c99b8b9e
2 changed files with 3 additions and 1 deletions

View File

@@ -159,7 +159,7 @@ fn (mut g Generator) gen_expr(expr Expr) {
g.out.write_string(mangle_var(expr.name)) g.out.write_string(mangle_var(expr.name))
} }
UnaryExpr { UnaryExpr {
g.out.write_string('${expr.ident}${expr.op}') g.out.write_string('(${mangle_var(expr.ident)}${expr.op})')
} }
BinaryExpr { BinaryExpr {
g.out.write_string('(') g.out.write_string('(')

View File

@@ -638,6 +638,8 @@ fn (mut p Parser) parse_func_decl() FuncDecl {
else{parse_error("Expected function return type after name when declaring ${name_tok.text}")} else{parse_error("Expected function return type after name when declaring ${name_tok.text}")}
} }
p.symbols.define_func(name_tok.text, type_tok.text, Block{})
block := p.parse_block(true) block := p.parse_block(true)
return_stmts := p.get_return_stmts_recursive(block) return_stmts := p.get_return_stmts_recursive(block)