bugfixes; removed notes feature in favor of alternate tag syntax
authorBrendan Hansen <brendan.f.hansen@gmail.com>
Thu, 8 Sep 2022 02:19:39 +0000 (21:19 -0500)
committerBrendan Hansen <brendan.f.hansen@gmail.com>
Thu, 8 Sep 2022 02:19:39 +0000 (21:19 -0500)
25 files changed:
compiler/src/checker.c
compiler/src/lex.c
compiler/src/parser.c
compiler/src/polymorph.h
compiler/src/symres.c
core/alloc/arena.onyx
core/alloc/pool.onyx
core/builtin.onyx
core/container/array.onyx
core/container/bucket_array.onyx
core/container/iter.onyx
core/container/map.onyx
core/conv.onyx
core/io/writer.onyx
core/net/tcp.onyx
core/runtime/info/helper.onyx
core/runtime/info/types.onyx
core/string.onyx
core/sync/mutex.onyx
core/sync/semaphore.onyx
core/wasi/wasi_fs.onyx
runtime/build.sh
scripts/onyx-pkg.onyx
scripts/run_tests.onyx
tests/float_parsing.onyx

index 333e331cf30c910becd47b4e802b7cb395d34211..f5c4a978d408008cf56d6de51a7cd54ce94ed5b6 100644 (file)
@@ -380,6 +380,22 @@ static CheckStatus collect_switch_case_blocks(AstSwitch* switchnode, AstBlock* r
                 break;
             }
 
+            case Ast_Kind_Static_If: {
+                // At this point, the static if will be resolved. So, this
+                // only needs to add the cases from one side or another.
+
+                AstIf* static_if = (AstIf *) walker;
+                assert(static_if->flags & Ast_Flag_Static_If_Resolved);
+
+                if (static_if_resolution(static_if)) {
+                    if (static_if->true_stmt) collect_switch_case_blocks(switchnode, static_if->true_stmt);
+                } else {
+                    if (static_if->false_stmt) collect_switch_case_blocks(switchnode, static_if->false_stmt);
+                }
+                
+                break;
+            }
+
             default:
                 ERROR(walker->token->pos, "This statement is not allowed here.");
         }
@@ -1689,12 +1705,15 @@ CheckStatus check_field_access(AstFieldAccess** pfield) {
             return Check_Success;
         }
 
+        if (!type_node) goto closest_not_found;
+
         char* closest = find_closest_symbol_in_node((AstNode *) type_node, field->field);
         if (closest) {
             ERROR_(field->token->pos, "Field '%s' does not exists on '%s'. Did you mean '%s'?", field->field, node_get_type_name(field->expr), closest);
-        } else {
-            ERROR_(field->token->pos, "Field '%s' does not exists on '%s'.", field->field, node_get_type_name(field->expr));
         }
+
+      closest_not_found:
+        ERROR_(field->token->pos, "Field '%s' does not exists on '%s'.", field->field, node_get_type_name(field->expr));
     }
 
     // NOTE: If this member was included into the structure through a "use x: ^T" kind of statement,
@@ -1726,7 +1745,6 @@ CheckStatus check_method_call(AstBinaryOp** pmcall) {
     CHECK(expression, &mcall->left);
     if (mcall->left->type == NULL) YIELD(mcall->token->pos, "Trying to resolve type of left hand side.");
 
-    mcall->type = mcall->left->type;
     AstTyped* implicit_argument = mcall->left;
 
     // Symbol resolution should have ensured that this is call node.
index eba315ed9fd6aa320ea7632b3ee7ddba95491639..db01e43da411f9f00fd332f14e201f8e6f686dca 100644 (file)
@@ -291,7 +291,7 @@ whitespace_skipped:
         goto token_parsed;
     }
 
-    if (*tokenizer->curr == '@') {
+    /*if (*tokenizer->curr == '@') {
         INCREMENT_CURR_TOKEN(tokenizer);
         u32 len = 2;
         while (char_is_alphanum(*(tokenizer->curr + 1)) || *(tokenizer->curr + 1) == '_') {
@@ -303,7 +303,7 @@ whitespace_skipped:
         tk.length = len;
         INCREMENT_CURR_TOKEN(tokenizer);
         goto token_parsed;
-    }
+    }*/
 
     // Number literal
     if (char_is_num(*tokenizer->curr)
index 1ccf7521e24bf6b6bb1de40693c62b32763e8bd5..e62459dc160f730d608c65e2d67693b82d914649 100644 (file)
@@ -86,11 +86,11 @@ static void consume_token(OnyxParser* parser) {
     // :LinearTokenDependent
     parser->curr++;
     while (parser->curr->type == Token_Type_Comment || parser->curr->type == Token_Type_Note) {
-        if (parser->curr->type == Token_Type_Note) {
-            AstNote* note = make_node(AstNode, Ast_Kind_Note);
-            note->token = parser->curr;
-            ENTITY_SUBMIT(note);
-        }
+        // if (parser->curr->type == Token_Type_Note) {
+        //     AstNote* note = make_node(AstNode, Ast_Kind_Note);
+        //     note->token = parser->curr;
+        //     ENTITY_SUBMIT(note);
+        // }
 
         parser->curr++;
     }
@@ -2048,7 +2048,7 @@ static AstStructType* parse_struct(OnyxParser* parser) {
         }
 
         bh_arr(AstTyped *) meta_tags=NULL;
-        while (parse_possible_directive(parser, "tag")) {
+        while (parse_possible_directive(parser, "tag") || consume_token_if_next(parser, '@')) {
             if (meta_tags == NULL) bh_arr_new(global_heap_allocator, meta_tags, 1);
 
             parser->tag_depth += 1;
@@ -3248,7 +3248,7 @@ static void parse_top_level_statement(OnyxParser* parser) {
                     consume_tokens(parser, 2);
                 }
 
-                inject->to_inject = parse_expression(parser, 0);
+                inject->to_inject = parse_top_level_expression(parser);
                 
                 ENTITY_SUBMIT(inject);
                 return;
@@ -3306,6 +3306,19 @@ static void parse_top_level_statement(OnyxParser* parser) {
                 onyx_report_error(directive_token->pos, Error_Critical, "unknown directive '#%b'.", symbol_token->text, symbol_token->length);
                 return;
             }
+
+            break;
+        }
+
+        case '@': {
+            consume_token(parser);
+            parser->tag_depth += 1;
+
+            AstTyped *expr = parse_expression(parser, 0);
+            bh_arr_push(parser->stored_tags, expr);
+
+            parser->tag_depth -= 1;
+            return;
         }
 
         default: break;
index 0185b8f3a02bbf15e8b74fe2ce704ad1ba3bf85c..693e1f771d2278e563033f79bd0ddb3d502bf991 100644 (file)
@@ -486,30 +486,29 @@ static void solve_for_polymorphic_param_type(PolySolveResult* resolved, AstFunct
             AstTyped* typed_param = lookup_param_in_arguments(func, param, args, err_msg);
             if (typed_param == NULL) return;
 
-            // CLEANUP FIXME HACK TODO GROSS
-            if (typed_param->kind == Ast_Kind_Argument) {
-                AstTyped* potential = ((AstArgument *) typed_param)->value;
-                if (potential->kind == Ast_Kind_Polymorphic_Proc) {
-                    if (param->idx < (u32) bh_arr_length(func->params)) {
-                        AstType *param_type = func->params[param->idx].local->type_node;
-                        if (param_type->kind == Ast_Kind_Function_Type) {
-                            AstFunctionType *ft = (AstFunctionType *) param_type;
-                            b32 all_types = 1;
-                            fori (i, 0, (i32) ft->param_count) {
-                                if (!node_is_type((AstNode *) ft->params[i])) {
-                                    all_types = 0;
-                                    break;
-                                }
-                            }
-
-                            if (all_types) {
-                                typed_param = try_lookup_based_on_partial_function_type((AstFunction *) potential, ft);
-                            }
-                        }
-                    }
+            if (typed_param->kind != Ast_Kind_Argument) goto skip_nested_polymorph_case;
+
+            AstTyped* potential = ((AstArgument *) typed_param)->value;
+            if (potential->kind != Ast_Kind_Polymorphic_Proc) goto skip_nested_polymorph_case;
+            if (param->idx >= (u32) bh_arr_length(func->params)) goto skip_nested_polymorph_case;
+
+            AstType *param_type = func->params[param->idx].local->type_node;
+            if (param_type->kind != Ast_Kind_Function_Type) goto skip_nested_polymorph_case;
+
+            AstFunctionType *ft = (AstFunctionType *) param_type;
+            b32 all_types = 1;
+            fori (i, 0, (i32) ft->param_count) {
+                if (!node_is_type((AstNode *) ft->params[i])) {
+                    all_types = 0;
+                    break;
                 }
             }
 
+            if (all_types) 
+                typed_param = try_lookup_based_on_partial_function_type((AstFunction *) potential, ft);
+
+          skip_nested_polymorph_case:
+
             actual_type = resolve_expression_type(typed_param);
             if (actual_type == NULL) return;
 
index 4410bb6264e3d0e4a7746b82765c50211ea69303..0a671e8de855e6da56dece9929bb17653b12a994 100644 (file)
@@ -323,8 +323,7 @@ static SymresStatus symres_field_access(AstFieldAccess** fa) {
     // the alias should have passed symbol resolution. If not, force a lookup
     // and yield if the alias was not ready.
     if ((*fa)->expr->kind == Ast_Kind_Alias) {
-        assert((*fa)->expr->entity);
-        if ((*fa)->expr->entity->state < Entity_State_Check_Types) {
+        if ((*fa)->expr->entity && (*fa)->expr->entity->state < Entity_State_Check_Types) {
             force_a_lookup = 1;
         }
     }
@@ -430,6 +429,22 @@ static SymresStatus symres_method_call(AstBinaryOp** mcall) {
             return Symres_Error;
         }
 
+        //
+        // This is a small hack that makes chaining method calls
+        // work. Because check_method_call replaces the method call
+        // and marks it as completed, if there are multiple references
+        // to the same method call node, one of them will be left dangling.
+        // To remedy this, an alias node an be placed around the method call
+        // so that when check_method_call replaces it, it is replaced
+        // within the alias, and all references are updated.
+        if ((*mcall)->left->kind == Ast_Kind_Method_Call) {
+            AstAlias *left_alias = onyx_ast_node_new(context.ast_alloc, sizeof(AstAlias), Ast_Kind_Alias);
+            left_alias->token = (*mcall)->left->token;
+            left_alias->alias = (*mcall)->left;
+
+            (*mcall)->left = (AstTyped *) left_alias;
+        }
+
         AstFieldAccess* implicit_field_access = make_field_access(context.ast_alloc, (*mcall)->left, NULL);
         implicit_field_access->token = ((AstCall *) (*mcall)->right)->callee->token;
         ((AstCall *) (*mcall)->right)->callee = (AstTyped *) implicit_field_access;
index 6224a442cf43a58c35fb91f652882169fb5ec281..729b21256f983770977ffc116e624864ec0bfa4a 100644 (file)
@@ -75,7 +75,7 @@ arena_alloc_proc :: (data: rawptr, aa: AllocationAction, size: u32, align: u32,
     return null;
 }
 
-@Note // `arena_size` must be at least 4
+// @Note // `arena_size` must be at least 4
 make :: (backing: Allocator, arena_size: u32) -> ArenaState {
     assert(arena_size >= 4, "Arena size was expected to be at least 4 bytes.");
     
index 12b003bbd7c5e40fad87b55ef93d76a0d0a259d8..8184902e15c47318b1a866e13b7ff61ce70cc8b6 100644 (file)
@@ -49,7 +49,7 @@ pool_alloc :: (pool: ^PoolAllocator($Elem)) -> ^Elem {
 }
 
 pool_free :: (pool: ^PoolAllocator($Elem), elem: ^Elem) {
-    @TODO
+    // @TODO
     // Add a check that the elem pointer is actually in the buffer?? 
     
     *(cast(^rawptr) elem) = cast(rawptr) pool.first_free;
index 1e5238161cdf933181e374f3d0ff51e37dd6fc29..04b9b0dede26df3385db66396b24fe3f15bf1e1a 100644 (file)
@@ -7,7 +7,7 @@ package builtin
 str  :: #type []u8;
 cstr :: #type ^u8;
 
-@Note
+// @Note
 // Because of many implementation details, all fields of this
 // struct are required to be i32's.
 range :: struct {
@@ -16,13 +16,13 @@ range :: struct {
     step : i32 = 1;
 }
 
-@Deprecated
+// @Deprecated
 vararg :: #type ^struct {
     data:  rawptr;
     count: i32;
 }
 
-@Deprecated
+// @Deprecated
 vararg_get :: #match {
     (va: vararg, ret: ^$T) -> bool {
         if va.count <= 0 do return false;
@@ -41,7 +41,7 @@ vararg_get :: #match {
     }
 }
 
-@NullProcHack
+// @NullProcHack
 null_proc :: () -> void #null ---
 null      :: cast(rawptr) 0;
 
index e747fb5d12707895324dca43a87a9367a907ce0e..50980be1234b1a9e26fc0136d147bd131b5cd60a 100644 (file)
@@ -343,7 +343,7 @@ sort :: (arr: [] $T, cmp: (T, T) -> i32) {
         x := arr.data[i];
         j := i - 1;
 
-        @ShortCircuitLogicalOps // This is written this way because '&&' does not short circuit right now.
+        // @ShortCircuitLogicalOps // This is written this way because '&&' does not short circuit right now.
         while j >= 0 {
             if cmp(arr.data[j], x) > 0 {
                 arr.data[j + 1] = arr.data[j];
index 14cc2847ca0d7a7e0e0fd951bf9876fd1d3a2ec0..6e07641ede5757371a995d07dfed2fc1f7e6d40b 100644 (file)
@@ -1,4 +1,4 @@
-@Incomplete // This implementation is not functional at all but is something I want to get around to adding.
+// @Incomplete // This implementation is not functional at all but is something I want to get around to adding.
 
 package core.bucket_array
 
index 33222bc11ec54a8bf803797ba1a2346c704d09ee..1ed4b11207eeca5b821cc61a01627ab38225fce8 100644 (file)
@@ -593,7 +593,7 @@ as_iterator :: (r: range) -> Iterator(i32) {
 
 fold :: #match #local {}
 
-@Cleanup // some way to shorten this would be nice
+// @Cleanup // some way to shorten this would be nice
 #overload
 fold :: macro (it: $T, init: $R, combine: $S) -> #auto where Iterable(T) {
     fold :: fold
index 7ef7bb732dfe5e5ed84b8930193214e010268d88..e2513ac0e08b93dca51387d5127a8f854e4c4adb 100644 (file)
@@ -138,7 +138,7 @@ delete :: (use map: ^Map, key: map.Key_Type) {
 }
 
 update :: macro (map: ^Map, key: map.Key_Type, body: Code) {
-    @Hack // Weird hack because 'lookup' exists at file scope.
+    // @Hack // Weird hack because 'lookup' exists at file scope.
     lookup_ :: lookup
 
     lr := lookup_(map, key);
@@ -160,7 +160,7 @@ empty :: (use map: ^Map) -> bool {
 format_map :: (output: ^conv.Format_Output, format: ^conv.Format, x: ^Map($K, $V)) {
     output->write("{\n");
     for^ x.entries {
-        conv.format(output, "    {\"} => {\"}\n", it.key, it.value);
+        conv.format(output, "    {\"p} => {\"p}\n", it.key, it.value);
     }
     output->write("}");
 }
index abc2231e4b5cfbf9531ffd2df98be7b365be5c9a..67f3e3b38a820158af1dad0773869eaafe0dfffb 100644 (file)
@@ -5,6 +5,7 @@ Enable_Custom_Formatters :: true
 #local {
     map :: package core.map
     string :: package core.string
+    array :: package core.array
 
     custom_formatters: Map(type_expr, #type (^Format_Output, ^Format, rawptr) -> void);
     custom_parsers   : Map(type_expr, #type (rawptr, str, Allocator) -> bool);
@@ -261,7 +262,7 @@ f64_to_str :: (f: f64, buf: [] u8, digits_after_decimal := 4) -> str {
     return str.{ buf.data, len };
 }
 
-@Remove // old aliases to not break old programs
+// @Remove // old aliases to not break old programs
 str_format :: format
 str_format_va :: format_va
 
@@ -321,6 +322,12 @@ Format :: struct {
     minimum_width := cast(u32) 0;
 }
 
+#local
+flush_to_dynstr :: (dynstr: ^[..] u8, to_write: str) => {
+    array.concat(dynstr, to_write);
+    return true;
+}
+
 
 format :: #match {}
 #match format (buffer: [] u8, format: str, va: ..any) -> str {
@@ -334,6 +341,19 @@ format :: #match {}
     out := format_va(*buffer, format, ~~va);
     buffer.count = out.count;
 }
+#match format (format: str, va: ..any) -> str {
+    buffer : [256] u8;
+    out    := make([..] u8);
+    output := Format_Output.{
+        ~~buffer, 0, buffer.count,
+        flush=.{ ^out, flush_to_dynstr }
+    };
+
+    final := format_va(^output, format, ~~va);
+    array.concat(^out, final);
+
+    return out;
+}
 
 format_va :: #match {}
 #match format_va (buffer: [] u8, format: str, va: [] any, flush := Format_Flush_Callback.{}) -> str {
@@ -345,6 +365,19 @@ format_va :: #match {}
     out := format_va(*buffer, format, va, flush);
     buffer.count = out.count;
 }
+#match format_va (format: [] u8, va: [] any) -> str {
+    buffer : [256] u8;
+    out    := make([..] u8);
+    output := Format_Output.{
+        ~~buffer, 0, buffer.count,
+        flush=.{ ^out, flush_to_dynstr }
+    };
+
+    final := format_va(^output, format, ~~va);
+    array.concat(^out, final);
+
+    return out;
+}
 
 #match format_va (output: ^Format_Output, format: str, va: [] any) -> str {
     vararg_index := 0;
@@ -553,7 +586,7 @@ format_any :: (output: ^Format_Output, formatting: ^Format, v: any) {
             width := formatting.minimum_width;
             to_output := *cast(^str) v.data;
 
-            @Todo // escape '"' when quote_strings is enabled.
+            // @Todo // escape '"' when quote_strings is enabled.
             output->write(to_output);
             if to_output.count < width && !(formatting.quote_strings || formatting.single_quote_strings) {
                 for width - to_output.count do output->write(#char " ");
@@ -795,7 +828,7 @@ parse_any :: #match {}
         return custom_parsers[data_type](target, to_parse, string_allocator);
     }
 
-    use package runtime.info;
+    use runtime.info;
     info := get_type_info(data_type);
 
     switch data_type {
@@ -846,7 +879,7 @@ parse_any :: #match {}
             //
             // For now, this will return a substring in the original to_parse.
             dest := cast(^str) target;
-            *dest = string.read_until(^line, #char "\"") |> string.alloc_copy(string_allocator); @BUG // This does not handle escaped strings!
+            *dest = string.read_until(^line, #char "\"") |> string.alloc_copy(string_allocator); // @BUG // This does not handle escaped strings!
             return true;
         }
 
@@ -857,6 +890,11 @@ parse_any :: #match {}
                 *cast(^u32) target = ~~ str_to_i64(to_parse);
                 return true;
             }
+
+            if info.kind == .Distinct {
+                d_info := cast(^Type_Info_Distinct) info;
+                return parse_any(target, d_info.base_type, to_parse, string_allocator);
+            }
         }
     }
 
index f545b9f0f04780b0e33c14d545053f7f019d9be8..a49c0e83c46f18fcf6674772d701567def2c5917 100644 (file)
@@ -107,7 +107,7 @@ write_escaped_str :: (use writer: ^Writer, s: str) {
         defer i += 1;
         ch := s[i];
 
-        @Incomplete
+        // @Incomplete
         switch ch {
             case #char "\n" { write_byte(writer, #char "\\"); write_byte(writer, #char "n");  }
             case #char "\r" { write_byte(writer, #char "\\"); write_byte(writer, #char "r");  }
@@ -119,7 +119,7 @@ write_escaped_str :: (use writer: ^Writer, s: str) {
             case #char "\"" { write_byte(writer, #char "\\"); write_byte(writer, #char "\""); }
 
             case #default {
-                @Speed
+                // @Speed
                 write_byte(writer, ch);
             }
         } 
index ced09615bd763c22d2b5106077fafa4bb394bede..99d773b1f80ce774ff8442bb73d30d76c7034977 100644 (file)
@@ -117,6 +117,10 @@ TCP_Server :: struct {
             Dying;
             Dead;
         }
+
+        read_complete :: (use this: ^Client) {
+            recv_ready_event_present = false;
+        }
     }
     client_allocator: Allocator;
     clients: [] ^Client;
@@ -176,7 +180,7 @@ tcp_server_make :: (max_clients := 32, allocator := context.allocator) -> ^TCP_S
         conn_event := new(TCP_Event.Connection, allocator=server.event_allocator);
         conn_event.address = ^client.address;
         conn_event.client = client;
-        server.events << .{ .Connection, conn_event }; @Threading // This operation should be protected by a mutex?
+        server.events << .{ .Connection, conn_event }; // @Threading // This operation should be protected by a mutex?
     }
 }
 
@@ -249,14 +253,14 @@ tcp_server_pulse :: (use server: ^TCP_Server) -> bool {
             data_event.client  = it;
             data_event.address = ^it.address;
             data_event.contents = memory.copy_slice(msg_buffer[0 .. bytes_read], allocator=server.event_allocator);
-            server.events << .{ .Data, data_event }; @Threading // See comment above.
+            server.events << .{ .Data, data_event }; // @Threading // See comment above.
 
         } elseif !it.recv_ready_event_present {
             it.recv_ready_event_present = true;
             ready_event := new(TCP_Event.Ready, allocator=server.event_allocator);
             ready_event.client  = it;
             ready_event.address = ^it.address;
-            server.events << .{ .Ready, ready_event }; @Threading // See comment above.
+            server.events << .{ .Ready, ready_event }; // @Threading // See comment above.
         }
     }
 
@@ -266,7 +270,7 @@ tcp_server_pulse :: (use server: ^TCP_Server) -> bool {
             disconnect_event := new(TCP_Event.Disconnection, allocator=server.event_allocator);
             disconnect_event.client  = it;
             disconnect_event.address = ^it.address;
-            server.events << .{ .Disconnection, disconnect_event }; @Threading // See comment above.
+            server.events << .{ .Disconnection, disconnect_event }; // @Threading // See comment above.
         }
     }
 
@@ -333,7 +337,7 @@ wait_to_get_client_messages :: (use server: ^TCP_Server) -> [] ^TCP_Server.Clien
     for clients {
         if it == null do continue;
 
-        if it.state == .Alive {
+        if it.state == .Alive && !it.recv_ready_event_present {
             active_clients[active_clients.count] = it;
             active_clients.count += 1;
         }
index e5621f2ff35b00f5a95fc00bba79a45954f2e1f0..394435ea4ad695f960ea19a58fbf204ceafacf24 100644 (file)
@@ -248,7 +248,7 @@ struct_inherits :: (struct_type: type_expr, base_type: type_expr) -> bool {
     if t1.is_variadic           != t2.is_variadic           do return false;
 
     while i := 0; i < t1.parameter_types.count {
-        @Robustness // This does not handle nested procedure types
+        // @Robustness // This does not handle nested procedure types
         if t1.parameter_types[i] != t2.parameter_types[i] do return false;
     }
 
index 0eb3dfaaae39bb49f26997109a5c87cd537d5984..f9884698b398db0a6e83a3fa76e218e7718f397c 100644 (file)
@@ -71,7 +71,7 @@ Type_Info_Basic :: struct {
 Type_Info_Pointer :: struct {
     use base : Type_Info;
 
-    @Rename
+    // @Rename
     to: type_expr;
 }
 
@@ -87,7 +87,7 @@ Type_Info_Function :: struct {
 Type_Info_Array :: struct {
     use base : Type_Info;
 
-    @Rename
+    // @Rename
     of: type_expr;
     count: u32;
 }
@@ -95,21 +95,21 @@ Type_Info_Array :: struct {
 Type_Info_Slice :: struct {
     use base : Type_Info;
 
-    @Rename
+    // @Rename
     of: type_expr;
 }
 
 Type_Info_Dynamic_Array :: struct {
     use base : Type_Info;
 
-    @Rename
+    // @Rename
     of: type_expr;
 }
 
 Type_Info_Variadic_Argument :: struct {
     use base : Type_Info;
 
-    @Rename
+    // @Rename
     of: type_expr;
 }
 
index f3beb1d2e8500210979dea72a1f210c081f0e0b3..e77239deb41c9b60c5b836d2f3415087fcc2535b 100644 (file)
@@ -65,7 +65,7 @@ concat :: (s1: str, s2: str, allocator := context.allocator) -> str {
     return str.{ data, len1 + len2 };
 }
 
-@Cleanup // Don't love that the allocator is necessary here,
+// @Cleanup // Don't love that the allocator is necessary here,
 // but it is impossible to specify a default value for the
 // allocator while having a variadic number of strings. This
 // is only due to the languages constraints however. This
@@ -138,7 +138,7 @@ contains :: (s: str, substr: str) -> bool {
 }
 
 
-@TODO
+// @TODO
 // Check this for edge cases and other bugs. I'm not confident
 // it will work perfectly yet.                   - brendanfh 2020/12/21
 compare :: (str1: str, str2: str) -> i32 {
index 4c1a8cfcbcd42d39df48d1220a2e9fa321d476b7..6e14505433c24fbe8d7a95fa86538b98aa3ad2b6 100644 (file)
@@ -37,7 +37,7 @@ mutex_lock :: (m: ^Mutex) {
         if m.owner == context.thread_id do return;
 
         #if runtime.Wait_Notify_Available {
-            @ThreadingCleanup // You cannot wait on the main thread in
+            // @ThreadingCleanup // You cannot wait on the main thread in
             // a web browser, for kind of obvious reasons. However, this
             // makes waiting for a mutex expensive because the only option
             // is to do a spin-lock. Ugh.
index 88de3b24ec476ab10c2d20a4c27d9d825eb86d9d..ee9bf7f5968fcacc89e64726860f4e13762bb777 100644 (file)
@@ -24,7 +24,7 @@ semaphore_post :: (s: ^Semaphore, count := 1) {
     scoped_mutex(^s.mutex);
     s.counter += count;
 
-    @Bug // This is susceptible to starvation. Semaphores should have a queue
+    // @Bug // This is susceptible to starvation. Semaphores should have a queue
     // or something like that.
     #if runtime.Wait_Notify_Available {
         __atomic_notify(^s.counter, maximum = count);
index 4b6eadb5ed49e2f37ebe9a99aca585c90aaf744b..4a1103e9745b9dd754271c11eca53a49b12e96ae 100644 (file)
@@ -98,7 +98,7 @@ __file_open :: (path: str, mode := os.OpenMode.Read) -> (FileData, os.FileError)
         }
     }
 
-    @TODO // provide a better error code.
+    // @TODO // provide a better error code.
     return file, .NotFound;
 }
 
index e5e4bdc5155b007ce97a9f7b3ef7a09cfb8bde3e..b0b461ceecbc45b9f6264f721753f5342c64e40a 100755 (executable)
@@ -2,7 +2,7 @@
 
 . ../settings.sh
 
-$CC -shared -fpic -w \
+$CC -shared -fpic -w -O2 \
     -o ../bin/onyx_runtime.so \
     -I ../shared/include -I ../compiler/include \
     ./onyx_runtime.c \
index 3c636171084e561178dda09fb4a740adf5537bfd..3ea34de96bbfd784b77d33fcd2dee07a05d1865d 100644 (file)
@@ -119,7 +119,7 @@ run_init_command :: (args: [] cstr) {
         }
     }
 
-    @TODO // Validation for these fields.
+    // @TODO // Validation for these fields.
     r := io.reader_make(^stdio_stream);
     read_field("Package name: ", ^config.metadata.name);
     read_field("Package description: ", ^config.metadata.description);
@@ -220,7 +220,7 @@ run_show_command :: (args: [] cstr) {
 }
 
 #tag Command.{ "update", "Update dependencies to newest compatible versions.", "" }
-@Feature // Add "locked" dependencies that will never update?
+// @Feature // Add "locked" dependencies that will never update?
 run_update_command :: (args: [] cstr) {
     printf("Updating dependencies to newest compatible versions.\n");
     for^ config.dependencies.dependencies.entries {
@@ -357,7 +357,7 @@ run_rebuild_command :: (args: [] cstr) {
 
 #tag Command.{ "publish", "Bump version number and create a publishable version of the package", "" }
 run_publish_command :: (args: [] cstr) {
-    @TODO // Better error handling and reporting, as this is a delicate process.
+    // @TODO // Better error handling and reporting, as this is a delicate process.
 
     if !os.dir_exists(".git") {
         printf("It does not look like you are in a Git repository. In order to publish packages\n");
index 01020d8c99f9dcfd4c4cadd0d995009b7323c9e8..a8a230529cb629987a52850e1fdc89a38cbce3c9 100644 (file)
@@ -95,7 +95,7 @@ main :: (args) => {
         // The executable to use when compiling
         onyx_cmd: str;
         at_least_one_test_failed := false;
-        compile_only := false;   @Bug // why is this necessary? why is settings.compile_only false when in the thread code?
+        compile_only := false;   // @Bug // why is this necessary? why is settings.compile_only false when in the thread code?
     }
     exec_context := init(Execution_Context);
     exec_context.compile_only = settings.compile_only;
index f050ec00ee5b378b8db253293a22095b178aef62..3d31942eef41095e8fea32858743681d2149668d 100644 (file)
@@ -4,7 +4,7 @@ use package core
 
 main :: (args: [] cstr) {
 
-    @CoreLibraries // The commented out cases can be re-enabled when f64_to_str is better.
+    // @CoreLibraries // The commented out cases can be re-enabled when f64_to_str is better.
     // Right now there is an integer overflow because it converts the float to an i64.
     strings := str.[
         /* these should parse fully */