From: Brendan Hansen Date: Tue, 22 Dec 2020 22:19:05 +0000 (-0600) Subject: small bugfixes X-Git-Url: https://git.brendanfh.com/?a=commitdiff_plain;h=156849cfd725aa2473d4d0638b36fa0dcea05c4b;p=onyx.git small bugfixes --- diff --git a/core/alloc.onyx b/core/alloc.onyx index 99d3f86c..a121e6f4 100644 --- a/core/alloc.onyx +++ b/core/alloc.onyx @@ -5,7 +5,7 @@ package core.alloc #include_file "core/alloc/heap" #include_file "core/alloc/ring" -TEMPORARY_ALLOCATOR_SIZE :: 1 << 12; // 16Kb +TEMPORARY_ALLOCATOR_SIZE :: 1 << 12; // 4Kb // The global heap allocator, set up upon program intialization. heap_allocator : Allocator; diff --git a/docs/bugs b/docs/bugs index 90890179..5f892b60 100644 --- a/docs/bugs +++ b/docs/bugs @@ -25,13 +25,23 @@ List of known bugs: which is doesn't match the second one, when the original parameters would have matched correctly. -[ ] `TileData :: [TILE_DATA_WIDTH * TILE_DATA_HEIGHT] bool;` results in a +[ ] `defer` statements are not executed at the end of a loop if the loop is + exited using a `break` statement, or a `continue` statement. The semantics + of this need to change because it is not expected behaviour. Also it would + prevent the usefulness of this pattern: + ``` + while i := 0; i < 10 { + defer i += 1; + ... + } + ``` + Since `continue`ing or `break`ing would skip the deferred statement, causing + an infinite loop. + +[X] `TileData :: [TILE_DATA_WIDTH * TILE_DATA_HEIGHT] bool;` results in a segfault because it is an invalid top level node, but that is not checked before it is tried to be used. -[ ] `defer` statements are not executed at the end of a loop if the loop is - exited using a `break` statement, or a `continue` statement. - [X] `TileData :: #type [TILE_DATA_WIDTH * TILE_DATA_HEIGHT] bool;` produces the following error: ``` diff --git a/onyx b/onyx index 4aec0830..a876c611 100755 Binary files a/onyx and b/onyx differ diff --git a/src/onyxparser.c b/src/onyxparser.c index bc890b6c..465c8b3b 100644 --- a/src/onyxparser.c +++ b/src/onyxparser.c @@ -1961,6 +1961,8 @@ static AstNode* parse_top_level_statement(OnyxParser* parser) { expect_token(parser, ':'); AstTyped* node = parse_top_level_expression(parser); + if (parser->hit_unexpected_token || node == NULL) + return NULL; node->flags |= private_kind;