From: Brendan Hansen Date: Sat, 5 Mar 2022 22:01:07 +0000 (-0600) Subject: bugfixing and new format overload X-Git-Url: https://git.brendanfh.com/?a=commitdiff_plain;h=bdaa1c87972bfaf4023b16428194ba93334b737a;p=onyx.git bugfixing and new format overload --- diff --git a/core/conv.onyx b/core/conv.onyx index db154b29..278d0a50 100644 --- a/core/conv.onyx +++ b/core/conv.onyx @@ -310,12 +310,22 @@ format :: #match {} #match format (output: ^Format_Output, format: str, va: ..any) -> str { return format_va(output, format, ~~va); } +#match format (buffer: ^[..] u8, format: str, va: ..any) { + buffer.count = buffer.capacity; + out := format_va(*buffer, format, ~~va); + buffer.count = out.count; +} format_va :: #match {} #match format_va (buffer: [] u8, format: str, va: [] any) -> str { output := Format_Output.{ buffer.data, 0, buffer.count }; return format_va(^output, format, va); } +#match format_va (buffer: ^[..] u8, format: str, va: [] any) { + buffer.count = buffer.capacity; + out := format_va(*buffer, format, va); + buffer.count = out.count; +} #match format_va (output: ^Format_Output, format: str, va: [] any) -> str { vararg_index := 0; diff --git a/src/checker.c b/src/checker.c index ca9afa83..5712060a 100644 --- a/src/checker.c +++ b/src/checker.c @@ -2548,8 +2548,12 @@ CheckStatus check_process_directive(AstNode* directive) { case Ast_Kind_Struct_Type: { AstStructType* st = (AstStructType *) tag->expr; - if (st->meta_tags == NULL) bh_arr_new(global_heap_allocator, st->meta_tags, 1); - bh_arr_push(st->meta_tags, tag->tag); + bh_arr(AstTyped *) tags = st->meta_tags; + + if (tags == NULL) bh_arr_new(global_heap_allocator, tags, 1); + bh_arr_push(tags, tag->tag); + + st->meta_tags = tags; return Check_Complete; }