Fix bug with empty returns

Signed-off-by: Slendi <slendi@socopon.com>
This commit is contained in:
Slendi 2024-04-09 02:34:41 +03:00
parent a5fd0f24dc
commit cb3183ba64
2 changed files with 4 additions and 1 deletions

View File

@ -468,6 +468,9 @@ type_check :: proc(ast: ^Node, parent_ast: ^Node) {
message_create(.Error, fmt.aprintf("Return statement outside of function"), ast.range),
)
} else {
if function_return_type.kind == .Integer && function_return_type.bit_size == 0 && ast.children[0] == nil {
break
}
type_check(ast.children[0], ast)
ok, cast_required := compare_types(function_return_type, ast.children[0].return_type)
if cast_required {
@ -736,7 +739,6 @@ find_function_definitions :: proc(ast_: ^Node) -> (ret: [dynamic]^FunctionType)
}
append(&ret, fn)
case .Struct:
fmt.printf("Struct found\n")
struct_ := struct_create()
should_ignore := true
for field in ast.children {

View File

@ -28,6 +28,7 @@ fn DrawRectangleWrap(x y w h: i32, c: Color) {
fn DrawCircleWrap(x y: i32, r: f32, c: Color) {
DrawCircle x y r (ColorToRaylib c)
ret
}
let white :: .Color{69 69 69 255}