small bugfixes
authorBrendan Hansen <brendan.f.hansen@gmail.com>
Tue, 22 Dec 2020 22:19:05 +0000 (16:19 -0600)
committerBrendan Hansen <brendan.f.hansen@gmail.com>
Tue, 22 Dec 2020 22:19:05 +0000 (16:19 -0600)
core/alloc.onyx
docs/bugs
onyx
src/onyxparser.c

index 99d3f86cd5e7ec74cda45e37e3a089417e538492..a121e6f42865e1bf157c9fd083a5080395a668f0 100644 (file)
@@ -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;
index 90890179ea7f8f28802688b67b0e947f6461c836..5f892b60a384e8ac3218a99ad3acce97184dfe15 100644 (file)
--- 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 4aec08301c0788ed0ef587d5d841aef10c7bf695..a876c611d7701c1e25f0f4a37d0db373f6a97a52 100755 (executable)
Binary files a/onyx and b/onyx differ
index bc890b6cfed71636fb1411430375f4a962e96545..465c8b3b6db1a2159ba6e3b2ac51358ef5014c5c 100644 (file)
@@ -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;