From b31d7488c3733d220cf7de556cab4d9ed688ce02 Mon Sep 17 00:00:00 2001 From: Vic Nightfall Date: Sun, 27 Aug 2023 22:43:49 +0200 Subject: [PATCH] Fix bug with function prototypes --- src/compiler.pr | 3 +++ src/typechecking.pr | 2 ++ 2 files changed, 5 insertions(+) diff --git a/src/compiler.pr b/src/compiler.pr index 8c8d7568..a2d06411 100644 --- a/src/compiler.pr +++ b/src/compiler.pr @@ -2667,6 +2667,7 @@ def insert_call( multiple_returns: bool, state: &State) { for var i in 0..args.size { + if i >= proto.size { continue } // Replace interfaces in proto with the actual type let np = proto[i] if np._tpe and np._tpe.kind == typechecking::TypeKind::STRUCTURAL { @@ -7061,6 +7062,8 @@ export def create_function( block = make_block() } + debug::trace("Compiling function " + function.name) + function.forward_declare = false function.allocas = vector::make(type &Insn) let current_function = errors::current_function diff --git a/src/typechecking.pr b/src/typechecking.pr index 745ed1e4..fdfc67a7 100644 --- a/src/typechecking.pr +++ b/src/typechecking.pr @@ -2117,6 +2117,8 @@ export def make_struct_type(fields: &[StructMember], current_type: &Type = null) if field.is_bitfield { #if defined WIN32 { // TODO Windows + bit_type = field.tpe + continue } else { // Linux if not bit_type {