'use package' and 'use' are unified; bugs will ensue
authorBrendan Hansen <brendan.f.hansen@gmail.com>
Wed, 14 Apr 2021 04:12:37 +0000 (23:12 -0500)
committerBrendan Hansen <brendan.f.hansen@gmail.com>
Wed, 14 Apr 2021 04:12:37 +0000 (23:12 -0500)
28 files changed:
bin/onyx
core/alloc/heap.onyx
core/io/file.onyx
include/bh.h
include/onyxastnodes.h
src/onyxastnodes.c
src/onyxclone.c
src/onyxentities.c
src/onyxparser.c
src/onyxsymres.c
src/onyxwasm.c
tests/aoc-2020/day10.onyx
tests/aoc-2020/day11.onyx
tests/aoc-2020/day12.onyx
tests/aoc-2020/day13.onyx
tests/aoc-2020/day14.onyx
tests/aoc-2020/day15.onyx
tests/aoc-2020/day16.onyx
tests/aoc-2020/day17.onyx
tests/aoc-2020/day18.onyx
tests/aoc-2020/day19.onyx
tests/aoc-2020/day20.onyx
tests/aoc-2020/day21.onyx
tests/aoc-2020/day22.onyx
tests/aoc-2020/day25.onyx
tests/aoc-2020/day7.onyx
tests/aoc-2020/day8.onyx
tests/aoc-2020/day9.onyx

index ca0e7fbf7d2e656e2319aba58b8a08701418f8ff..9d538e7114c141534849b16a50ec4b45c66c236f 100755 (executable)
Binary files a/bin/onyx and b/bin/onyx differ
index 6c0643703ffc359143d4120d44e8fedf7d569de3..52a43c5f83e292bafdf98b93555dcef70ddf7f86 100644 (file)
@@ -10,7 +10,7 @@ package core.alloc.heap
 #load "core/intrinsics/wasm"
 
 use package core.intrinsics.wasm { memory_size, memory_grow }
-use package core.memory as memory
+#private_file memory :: package core.memory
 
 // The global heap state
 #private_file
@@ -142,4 +142,4 @@ init :: () {
     use package core.alloc { heap_allocator }
     heap_allocator.data = ^heap_state;
     heap_allocator.func = heap_alloc_proc;
-}
\ No newline at end of file
+}
index cee57a7db3926b55b3c1f49927ee37de1fc3c8a7..640ea14156ef02ae8a73a75eb86b9f6a2d957fda 100644 (file)
@@ -1,6 +1,6 @@
 package core.io
 
-use package runtime as runtime
+#private_file runtime :: package runtime
 #if runtime.Runtime != runtime.Runtime_Wasi {
     #error "The file system library is currently only available on the WASI runtime, and should only be included if that is the chosen runtime."
 }
index c3dcdb32d94df6d654f65d5e3ed063de0008dac3..2afef54c84d71aa553145a616bf7b5ff19561bb8 100644 (file)
@@ -568,7 +568,7 @@ void bh__arr_deleten(void **arr, i32 elemsize, i32 index, i32 numelems);
 u64 bh__table_hash_function(const char* str, i32 len, i32 mod) {
     u64 hash = 5381;
     i32 c, l = 0;
-    if (len == 0) len = ((u32) 1 << 31) - 1; // TODO: Verify this is right
+    if (len == 0) len = ((u32) 1 << 31) - 1;
 
     while ((c = *str++) && l++ < len) {
         hash = (hash << 5) + hash + c;
index cdd4047c280a237dcc9ac5eadf41a4cf66bfab10..a3c147bb2c9b68e83fdc5c1eaa33c409b4edd507 100644 (file)
@@ -98,7 +98,6 @@ typedef enum AstKind {
     Ast_Kind_Package,
     Ast_Kind_Load_File,
     Ast_Kind_Load_Path,
-    Ast_Kind_Use_Package,
     Ast_Kind_Alias,
     Ast_Kind_Memres,
 
@@ -557,7 +556,12 @@ struct AstDirectiveSolidify {
 // Intruction Node
 struct AstReturn        { AstNode_base; AstTyped* expr; };
 struct AstJump          { AstNode_base; JumpType jump; u32 count; };
-struct AstUse           { AstNode_base; AstTyped* expr; };
+struct AstUse           {
+    AstNode_base;
+
+    AstTyped* expr;
+    bh_arr(AstAlias *) only;
+};
 
 // Structure Nodes
 struct AstBlock         {
@@ -709,16 +713,6 @@ struct AstCompoundType {
 struct AstBinding       { AstTyped_base; AstNode* node; };
 struct AstMemRes        { AstTyped_base; u64 addr; AstTyped *initial_value; };
 struct AstInclude       { AstNode_base; char* name; };
-struct AstUsePackage    {
-    AstNode_base;
-
-    AstPackage *package;
-
-    OnyxToken *alias;
-    AstPackage *alias_node;
-
-    bh_arr(AstAlias *) only;
-};
 struct AstAlias         {
     AstNode_base;
     OnyxToken *alias;
@@ -965,7 +959,6 @@ typedef struct Entity {
     union {
         AstDirectiveError     *error;
         AstInclude            *include;
-        AstUsePackage         *use_package;
         AstBinding            *binding;
         AstStaticIf           *static_if;
         AstFunction           *function;
index 6811e98c73a43236b9bb790ea5b87428ac7f7c36..c7a0354ad9fa68d5f366ee3112dd197200095e26 100644 (file)
@@ -9,7 +9,6 @@ static const char* ast_node_names[] = {
     "PACKAGE",
     "INCLUDE FILE",
     "INCLUDE FOLDER",
-    "USE PACKAGE",
     "ALIAS",
     "MEMORY RESERVATION",
 
index 60cae9241a41f07e337d44eb2717d2161e4fbe61..e4a76f6a122b7938de350b71bffa05549d99ee61 100644 (file)
@@ -15,7 +15,6 @@ static inline b32 should_clone(AstNode* node) {
                case Ast_Kind_Enum_Value:
                case Ast_Kind_Overloaded_Function:
                case Ast_Kind_Polymorphic_Proc:
-               case Ast_Kind_Use_Package:
                        return 0;
 
                default: return 1;
@@ -28,7 +27,6 @@ static inline i32 ast_kind_to_size(AstNode* node) {
         case Ast_Kind_Package: return sizeof(AstPackage);
         case Ast_Kind_Load_File: return sizeof(AstInclude);
         case Ast_Kind_Load_Path: return sizeof(AstInclude);
-        case Ast_Kind_Use_Package: return sizeof(AstUsePackage);
         case Ast_Kind_Alias: return sizeof(AstAlias);
         case Ast_Kind_Memres: return sizeof(AstMemRes);
         case Ast_Kind_Binding: return sizeof(AstBinding);
index ce4112c0ecef3a92db03ad772a363404009401d6..955e039b6fb6ba69b841d69aaa3a956179983595 100644 (file)
@@ -256,16 +256,14 @@ void add_entities_for_node(bh_arr(Entity *) *target_arr, AstNode* node, Scope* s
             break;
         }
         
-        case Ast_Kind_Use_Package: {
-            ent.state = Entity_State_Comptime_Resolve_Symbols;
-            ent.type = Entity_Type_Use_Package;
-            ent.use_package = (AstUsePackage *) node;
-            ENTITY_INSERT(ent);
-            break;
-        }
-        
         case Ast_Kind_Use: {
-            ent.type = Entity_Type_Use;
+            if (((AstUse *) node)->expr->kind == Ast_Kind_Package) {
+                ent.state = Entity_State_Comptime_Resolve_Symbols;
+                ent.type = Entity_Type_Use_Package;
+            } else {
+                ent.type = Entity_Type_Use;
+            }
+
             ent.use = (AstUse *) node;
             ENTITY_INSERT(ent);
             break;
index f878f16ae1109d766f1346da45efe27159c3319a..34e6d7820ea945f945798a8d3a5c9f71d13519d6 100644 (file)
@@ -80,7 +80,6 @@ static void consume_token(OnyxParser* parser) {
 static void unconsume_token(OnyxParser* parser) {
     if (parser->hit_unexpected_token) return;
 
-    // TODO: This is probably wrong
     while (parser->prev->type == Token_Type_Comment) parser->prev--;
     parser->curr = parser->prev;
     parser->prev--;
@@ -1154,43 +1153,36 @@ static AstReturn* parse_return_stmt(OnyxParser* parser) {
 
 static AstNode* parse_use_stmt(OnyxParser* parser) {
     OnyxToken* use_token = expect_token(parser, Token_Type_Keyword_Use);
+    AstUse* use_node = make_node(AstUse, Ast_Kind_Use);
+    use_node->token = use_token;
+    use_node->expr = parse_expression(parser, 1);
 
-    if (parser->curr->type == Token_Type_Keyword_Package) {
-        AstUsePackage* upack = make_node(AstUsePackage, Ast_Kind_Use_Package);
-        upack->token = use_token;
-        upack->package = parse_package_expression(parser);
-
-        if (consume_token_if_next(parser, Token_Type_Keyword_As))
-            upack->alias = expect_token(parser, Token_Type_Symbol);
-
-        if (consume_token_if_next(parser, '{')) {
-            bh_arr_new(global_heap_allocator, upack->only, 4);
+    if (consume_token_if_next(parser, '{')) {
+        bh_arr_new(global_heap_allocator, use_node->only, 4);
 
-            while (!consume_token_if_next(parser, '}')) {
-                if (parser->hit_unexpected_token) return NULL;
+        while (!consume_token_if_next(parser, '}')) {
+            if (parser->hit_unexpected_token) return NULL;
 
-                AstAlias* alias = make_node(AstAlias, Ast_Kind_Alias);
-                alias->token = expect_token(parser, Token_Type_Symbol);
+            AstAlias* alias = make_node(AstAlias, Ast_Kind_Alias);
+            alias->token = expect_token(parser, Token_Type_Symbol);
 
-                if (consume_token_if_next(parser, Token_Type_Keyword_As))
-                    alias->alias = expect_token(parser, Token_Type_Symbol);
-                else
-                    alias->alias = alias->token;
+            if (consume_token_if_next(parser, Token_Type_Keyword_As))
+                alias->alias = expect_token(parser, Token_Type_Symbol);
+            else
+                alias->alias = alias->token;
 
-                bh_arr_push(upack->only, alias);
+            bh_arr_push(use_node->only, alias);
 
-                if (parser->curr->type != '}')
-                    expect_token(parser, ',');
-            }
+            if (parser->curr->type != '}')
+                expect_token(parser, ',');
         }
-        
-        ENTITY_SUBMIT(upack);
+    }
+
+    if (use_node->expr->kind == Ast_Kind_Package) {
+        ENTITY_SUBMIT(use_node);
         return NULL;
 
     } else {
-        AstUse* use_node = make_node(AstUse, Ast_Kind_Use);
-        use_node->token = use_token;
-        use_node->expr = parse_expression(parser, 1);
         return (AstNode *) use_node;
     }
 }
@@ -2456,10 +2448,10 @@ void onyx_parse(OnyxParser *parser) {
     parser->file_scope = scope_create(parser->allocator, parser->package->private_scope, parser->tokenizer->tokens[0].pos);
     bh_arr_push(parser->scope_stack, parser->file_scope);
 
-    AstUsePackage* implicit_use_builtin = make_node(AstUsePackage, Ast_Kind_Use_Package);
+    AstUse* implicit_use_builtin = make_node(AstUse, Ast_Kind_Use);
     AstPackage* implicit_builtin_package = make_node(AstPackage, Ast_Kind_Package);
     implicit_builtin_package->package_name = "builtin";
-    implicit_use_builtin->package = implicit_builtin_package;
+    implicit_use_builtin->expr = (AstTyped *) implicit_builtin_package;
     ENTITY_SUBMIT(implicit_use_builtin);
 
     while (parser->curr->type != Token_Type_End_Stream) {
index 80bcb118af7f5db432142e6ffa598149f0f2a452..4a0282a8e01cc595de9d56613f8a270f3f4f1abb 100644 (file)
@@ -52,7 +52,6 @@ static SymresStatus symres_function_header(AstFunction* func);
 static SymresStatus symres_function(AstFunction* func);
 static SymresStatus symres_global(AstGlobal* global);
 static SymresStatus symres_overloaded_function(AstOverloadedFunction* ofunc);
-static SymresStatus symres_use_package(AstUsePackage* package);
 static SymresStatus symres_package(AstPackage* package);
 static SymresStatus symres_enum(AstEnumType* enum_node);
 static SymresStatus symres_memres_type(AstMemRes** memres);
@@ -582,12 +581,44 @@ static SymresStatus symres_switch(AstSwitch* switchnode) {
     return Symres_Success;
 }
 
+// CLEANUP: A lot of duplication going on in this function. A proper
+// "namespace" concept would be useful to remove a lot of the fluff
+// code here. There already is try_resolve_symbol_from_node which
+// may be able to do what is needed here?
 static SymresStatus symres_use(AstUse* use) {
     SYMRES(expression, &use->expr);
 
     if (use->expr->kind == Ast_Kind_Package) {
         AstPackage* package = (AstPackage *) use->expr;
-        scope_include(curr_scope, package->package->scope, use->token->pos);
+        SYMRES(package, package);
+
+        if (package->package->scope == curr_scope) return Symres_Success;
+
+        if (use->only == NULL) {
+            OnyxFilePos pos = { 0 };
+            if (use->token != NULL)
+                pos = use->token->pos;
+
+            scope_include(curr_scope, package->package->scope, pos);
+
+        } else {
+            bh_arr_each(AstAlias *, alias, use->only) {
+                AstNode* thing = symbol_resolve(package->package->scope, (*alias)->token);
+                if (thing == NULL) { // :SymresStall
+                    if (report_unresolved_symbols) {
+                        onyx_report_error((*alias)->token->pos,
+                                "The symbol '%b' was not found in this package.",
+                                (*alias)->token->text, (*alias)->token->length);
+                        return Symres_Error;
+                    } else {
+                        return Symres_Yield_Macro;
+                    }
+                }
+
+                symbol_introduce(curr_scope, (*alias)->alias, thing);
+            }
+        }
+
         return Symres_Success;
     }
 
@@ -602,10 +633,25 @@ static SymresStatus symres_use(AstUse* use) {
 
     if (use->expr->kind == Ast_Kind_Struct_Type) {
         AstStructType* st = (AstStructType *) use->expr;
+        if (!st->scope) return Symres_Success;
 
-        if (st->scope)
+        if (use->only == NULL) {
             scope_include(curr_scope, st->scope, use->token->pos);
 
+        } else {
+            bh_arr_each(AstAlias *, alias, use->only) {
+                AstNode* thing = symbol_resolve(st->scope, (*alias)->token);
+                if (thing == NULL) {
+                    onyx_report_error((*alias)->token->pos,
+                            "The symbol '%b' was not found in this scope.",
+                            (*alias)->token->text, (*alias)->token->length);
+                    return Symres_Error;
+                }
+
+                symbol_introduce(curr_scope, (*alias)->alias, thing);
+            }
+        }
+
         return Symres_Success;
     }
 
@@ -706,12 +752,6 @@ static SymresStatus symres_statement(AstNode** stmt, b32 *remove) {
             SYMRES(use, (AstUse *) *stmt);
             break;
 
-        case Ast_Kind_Use_Package:
-            if (remove) *remove = 1;
-            // This is handled by an entity now.
-            // SYMRES(use_package, (AstUsePackage *) *stmt);
-            break;
-
         default: SYMRES(expression, (AstTyped **) stmt); break;
     }
 
@@ -886,52 +926,6 @@ static SymresStatus symres_overloaded_function(AstOverloadedFunction* ofunc) {
     return Symres_Success;
 }
 
-static SymresStatus symres_use_package(AstUsePackage* package) {
-    SYMRES(package, package->package);
-
-    // CLEANUP: Oofta that name
-    Package* p = package->package->package;
-
-    if (p->scope == curr_scope) return Symres_Success;
-
-    if (package->alias != NULL) {
-        if (!package->alias_node) {
-            package->alias_node = onyx_ast_node_new(context.ast_alloc, sizeof(AstPackage), Ast_Kind_Package);
-            package->alias_node->package = p;
-            package->alias_node->token = package->alias;
-        }
-
-        symbol_introduce(curr_scope, package->alias, (AstNode *) package->alias_node);
-    }
-
-    if (package->only != NULL) {
-        bh_arr_each(AstAlias *, alias, package->only) {
-
-            AstNode* thing = symbol_resolve(p->scope, (*alias)->token);
-            if (thing == NULL) { // :SymresStall
-                if (report_unresolved_symbols) {
-                    onyx_report_error((*alias)->token->pos, "This symbol was not found in this package.");
-                    return Symres_Error;
-                } else {
-                    return Symres_Yield_Macro;
-                }
-            }
-
-            symbol_introduce(curr_scope, (*alias)->alias, thing);
-        }
-    }
-
-    if (package->alias == NULL && package->only == NULL) {
-        OnyxFilePos pos = { 0 };
-        if (package->token != NULL)
-            pos = package->token->pos;
-
-        scope_include(curr_scope, p->scope, pos);
-    }
-
-    return Symres_Success;
-}
-
 static SymresStatus symres_package(AstPackage* package) {
     if (package->package == NULL) {
         if (!package->package_name) return Symres_Error;
@@ -1100,9 +1094,9 @@ void symres_entity(Entity* ent) {
         case Entity_Type_Foreign_Global_Header:
         case Entity_Type_Global_Header:           ss = symres_global(ent->global); break;
 
-        case Entity_Type_Use_Package:             ss = symres_use_package(ent->use_package);
-                                                  if (ent->use_package->package && ent->use_package->package->package)
-                                                      package_track_use_package(ent->use_package->package->package, ent);
+        case Entity_Type_Use_Package:             ss = symres_use(ent->use);
+                                                  if (ent->use->expr && ((AstPackage *) ent->use->expr)->package)
+                                                      package_track_use_package(((AstPackage *) ent->use->expr)->package, ent);
                                                   next_state = Entity_State_Finalized;
                                                   break;
 
index 147685cca7fb553a2b68e9bae45555b334c6befc..f4ae1fc3a3655edaec451bfc5df97650577d2861 100644 (file)
@@ -2495,7 +2495,6 @@ static i32 generate_type_idx(OnyxWasmModule* mod, Type* ft) {
         type_idx = bh_table_get(i32, mod->type_map, type_repr_buf);
     } else {
         // NOTE: Make a new type
-        // TODO: Ensure that this isn't going to break things because of alignment
         WasmFuncType* type = (WasmFuncType*) bh_alloc(mod->allocator, sizeof(WasmFuncType) + sizeof(WasmType) * param_count);
         type->return_type = return_type;
         type->param_count = param_count;
index 2eb0cca041d6643f8c6469e82291e5d4f4caf2d8..61f942b6ac2cb329e97e5baee01b85ee585aa753 100644 (file)
@@ -1,7 +1,7 @@
 #load "core/std"
 
 use package core
-use package core.string.reader as reader
+reader :: package core.string.reader
 
 count_ending_paths :: (nums: [..] u32) -> u64 {
     tally := array.make(u64, nums.count);
index dccf87653d91d6e5613bb4766ccc42be440ecc53..af756dc5780788122fc71a94bad1b2fcaba9ed05 100644 (file)
@@ -1,7 +1,7 @@
 #load "core/std"
 
 use package core
-use package core.string.reader as reader
+reader :: package core.string.reader
 
 GameOfSeats :: struct {
     width  : u32;
index 63e4264201ee66c582f9988e47e7bc0866d5cf7f..0dd6ff557824818608d07b6bc38367cf4ce6610d 100644 (file)
@@ -1,7 +1,7 @@
 #load "core/std"
 
 use package core
-use package core.string.reader as reader
+reader :: package core.string.reader
 
 Ship :: struct {
     x : i32 = 0;
index c6154bb0c9f1ca908a66f2673d2f4a2c3aad9020..1cfd7f59b08c55bbe93304c645b5f01b3eb15892 100644 (file)
@@ -1,7 +1,7 @@
 #load "core/std"
 
 use package core
-use package core.string.reader as reader
+reader :: package core.string.reader
 
 inv_mod :: (a_: i64, m_: i64) -> i64 {
     if m_ <= 1 do return 0;
index 3903638fbf6f2cf6bb24ab010c212f5a8c958395..a0bb53c70b1d2809b0d895db223026e5aa07c24b 100644 (file)
@@ -1,7 +1,7 @@
 #load "core/std"
 
 use package core
-use package core.string.reader as reader
+reader :: package core.string.reader
 
 MASK_SIZE :: 36
 Bitmask :: #type [MASK_SIZE] u8;
index 379be8ac2792860e31ab90199911b7015df19c4d..168ced9cba08a0714dd0d0e5e3b5f1903b3c4576 100644 (file)
@@ -1,7 +1,7 @@
 #load "core/std"
 
 use package core
-use package core.string.reader as reader
+reader :: package core.string.reader
 
 initial_numbers := u32.[ 1, 20, 8, 12, 0, 14 ];
 
index 3ce7c0f211ad21a1c35bd8284a9f52e2954ac76a..f15c9db178f837e83f4560db3547a011cae57069 100644 (file)
@@ -1,7 +1,7 @@
 #load "core/std"
 
 use package core
-use package core.string.reader as reader
+reader :: package core.string.reader
 
 Field :: struct {
        name : str = "";
index ea22356bd46824722811467e76f4ea103acb7d65..8aff1ac742e4792d29fbd1cbad8b0e7917a86d39 100644 (file)
@@ -1,7 +1,7 @@
 #load "core/std"
 
 use package core
-use package core.string.reader as reader
+reader :: package core.string.reader
 
 CubePos :: struct {
     x, y, z, w : i32;
index 0b38252fc3993d265e721fa57824e179b593efc2..294fe09aea0077ce6f6ec6974ae4a9ee31bc5186 100644 (file)
@@ -1,7 +1,7 @@
 #load "core/std"
 
 use package core
-use package core.string.reader as reader
+reader :: package core.string.reader
 
 parse_factor :: (file: ^reader.StringReader) -> u64 {
        reader.skip_whitespace(file);
index 4e105e9a23a8bf1771967e6312d339f31213dc83..5b0ded1dd83fa7c272cb6b82ae4c72b11c8a027e 100644 (file)
@@ -1,7 +1,7 @@
 #load "core/std"
 
 use package core
-use package core.string.reader as reader
+reader :: package core.string.reader
 
 // nt -> t
 Term :: struct {
index 806e44a06a6f07a5819a2f9e96b0d2a11e0dfa84..dafa71cc65248a56200c7457f27c15555e8ea358 100644 (file)
@@ -1,7 +1,7 @@
 #load "core/std"
 
 use package core
-use package core.string.reader as reader
+reader :: package core.string.reader
 
 TILE_DATA_WIDTH  :: 10
 TILE_DATA_HEIGHT :: 10
index 8c6ad0ccfb5cb973188ff40954c63dcaa54d520e..12fb70d165a1808a9ce4d698f236cd771f15c7c0 100644 (file)
@@ -1,7 +1,7 @@
 #load "core/std"
 
 use package core
-use package core.string.reader as reader
+reader :: package core.string.reader
 
 /*
        What questions the data layout needs to answer easily:
index ca2038ef60005b76f23b5c4bcb58a34b33da77fe..29cab03d7ab791bad66a0f54f2880f67d7604df4 100644 (file)
@@ -1,7 +1,7 @@
 #load "core/std"
 
 use package core
-use package core.string.reader as reader
+reader :: package core.string.reader
 
 key_arena : alloc.arena.ArenaState;
 key_alloc : Allocator;
@@ -43,7 +43,7 @@ combat :: (player1: ^[..] u32, player2: ^[..] u32) -> u32 {
 //   4,5,2,8,|1,3,9,7,
 // Larger numbers are encoded in base 64.
 encode_hands :: (alloc: Allocator, p1: ^[..] u32, p2: ^[..] u32) -> str {
-    use package core.string.builder as b
+    b :: package core.string.builder
 
     builder := b.make(256, alloc);
     for n: *p1 {
index 0ca1507b73d6adc86cd298a2453ad52886ca79cf..db11f1ece328807820eea9c158158c5cd082e06d 100644 (file)
@@ -1,7 +1,7 @@
 #load "core/std"
 
 use package core
-use package core.string.reader as reader
+reader :: package core.string.reader
 
 power_mod :: (base: u32, exp: u32, mod: u32) -> u32 {
     t: u64 = 1;
index 2fe27d120f32dd88511e545a4772d7ff4e6c90fd..8c06460b9c03f8d950eee72c6ed4d7538c161b60 100644 (file)
@@ -1,7 +1,7 @@
 #load "core/std"
 
 use package core
-use package core.string.reader as reader
+reader :: package core.string.reader
 
 BagGraph :: struct {
     nodes    : [..] ^BagNode;
index 49d18718d6abf802f3387e7b788dc352593e03f8..61728050650b45514f97ca1fff577fe82afa4a97 100644 (file)
@@ -1,7 +1,7 @@
 #load "core/std"
 
 use package core
-use package core.string.reader as reader
+reader :: package core.string.reader
 
 OpCode :: enum (u16) {
     Nop; Acc; Jmp;
index 10d5e1daf58af59f1ffc2759e129c6e7f14ed238..8df60e34453aec801b9abb908a4b4fab16cd64a0 100644 (file)
@@ -1,7 +1,7 @@
 #load "core/std"
 
 use package core
-use package core.string.reader as reader
+reader :: package core.string.reader
 
 find_contiguous_subarray_with_sum :: (nums: [..] u64, sum: u64) -> (i32, i32) {
     start := 0;