added: `#import` functions as `use` statement
authorBrendan Hansen <brendan.f.hansen@gmail.com>
Sat, 25 Mar 2023 19:31:17 +0000 (14:31 -0500)
committerBrendan Hansen <brendan.f.hansen@gmail.com>
Sat, 25 Mar 2023 19:31:17 +0000 (14:31 -0500)
78 files changed:
compiler/include/astnodes.h
compiler/src/parser.c
tests/aoc-2020/day10.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/day18.onyx
tests/aoc-2020/day19.onyx
tests/aoc-2020/day2.onyx
tests/aoc-2020/day20.onyx
tests/aoc-2020/day21.onyx
tests/aoc-2020/day22.onyx
tests/aoc-2020/day23.onyx
tests/aoc-2020/day24.onyx
tests/aoc-2020/day25.onyx
tests/aoc-2020/day3.onyx
tests/aoc-2020/day4.onyx
tests/aoc-2020/day5.onyx
tests/aoc-2020/day6.onyx
tests/aoc-2020/day7.onyx
tests/aoc-2020/day8.onyx
tests/aoc-2020/day9.onyx
tests/aoc-2021/day01.onyx
tests/aoc-2021/day02.onyx
tests/aoc-2021/day03.onyx
tests/aoc-2021/day04.onyx
tests/aoc-2021/day05.onyx
tests/aoc-2021/day06.onyx
tests/aoc-2021/day07.onyx
tests/aoc-2021/day08.onyx
tests/aoc-2021/day09.onyx
tests/aoc-2021/day10.onyx
tests/aoc-2021/day11.onyx
tests/aoc-2021/day12.onyx
tests/aoc-2021/day13.onyx
tests/aoc-2021/day14.onyx
tests/aoc-2021/day15.onyx
tests/aoc-2021/day16.onyx
tests/aoc-2021/day17.onyx
tests/array_struct_robustness.onyx
tests/atomics.onyx
tests/auto_poly.onyx
tests/avl_test.onyx
tests/baked_parameters.onyx
tests/better_field_accesses.onyx
tests/bucket_array.onyx
tests/bugs/anonymous_struct_defaults.onyx
tests/bugs/defer_block_in_macro.onyx
tests/bugs/fallthrough_defer_interaction.onyx
tests/bugs/macro_auto_return_not_resolved.onyx
tests/bugs/namespace_aliasing.onyx
tests/caller_location.onyx
tests/compile_time_procedures.onyx
tests/complicated_polymorph.onyx
tests/defer_with_continue.onyx
tests/defined_test.onyx
tests/float_parsing.onyx
tests/i32map.onyx
tests/implicit_initialize_locals.onyx
tests/init_procedures.onyx
tests/lazy_iterators.onyx
tests/named_arguments_test.onyx
tests/new_printf.onyx
tests/new_struct_behaviour.onyx
tests/operator_overload.onyx
tests/overload_precedence.onyx
tests/persist_locals.onyx
tests/poly_struct_in_type_info.onyx
tests/poly_structs_with_values.onyx
tests/polymorphic_array_lengths.onyx
tests/remove_test.onyx
tests/sets.onyx
tests/struct_robustness.onyx
tests/struct_use_pointer_member.onyx
tests/switch_using_equals.onyx
tests/vararg_test.onyx

index 5e5aef919ef8724bfc6034077585fd659d3128c3..0043a259ae573b88f76d4ac09cc79248ba3d4da3 100644 (file)
@@ -1176,6 +1176,8 @@ struct AstImport {
     AstNode_base;
 
     AstPackage *imported_package;
+
+    AstUse *implicit_use_node;
 };
 
 
index 174566f301b8f111595c77a0f1a8abfdc4fbad65..a24f8d1cca061e9acf6e2b96c36513bd937831ce 100644 (file)
@@ -1494,18 +1494,16 @@ static AstReturn* parse_return_stmt(OnyxParser* parser) {
     return return_node;
 }
 
-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 (!use_node->expr) return NULL;
-
+static b32 parse_use_stmt_internal(OnyxParser* parser, AstUse* use_node) {
     if (consume_token_if_next(parser, '{')) {
-        bh_arr_new(global_heap_allocator, use_node->only, 4);
+        if (next_tokens_are(parser, 2, '*', '}')) {
+            consume_tokens(parser, 2);
+            return 1;
+        }
 
+        bh_arr_new(global_heap_allocator, use_node->only, 4);
         while (!consume_token_if_next(parser, '}')) {
-            if (parser->hit_unexpected_token) return NULL;
+            if (parser->hit_unexpected_token) return 0;
 
             QualifiedUse qu;
             qu.as_name = expect_token(parser, Token_Type_Symbol);
@@ -1523,6 +1521,18 @@ static AstNode* parse_use_stmt(OnyxParser* parser) {
         }
     }
 
+    return 1;
+}
+
+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 (!use_node->expr) return NULL;
+
+    if (!parse_use_stmt_internal(parser, use_node)) return NULL;
+
     if (use_node->expr->kind == Ast_Kind_Package) {
         ENTITY_SUBMIT(use_node);
         return NULL;
@@ -3667,6 +3677,17 @@ static AstImport* parse_import_statement(OnyxParser* parser, OnyxToken *token) {
 
     import_node->imported_package = package_node;
 
+    if (parser->curr->type == '{') {
+        AstUse *use_node = make_node(AstUse, Ast_Kind_Use);
+        use_node->token = parser->curr;
+        use_node->expr = (AstTyped *) package_node;
+
+        if (!parse_use_stmt_internal(parser, use_node)) return NULL;
+
+        import_node->implicit_use_node = use_node;
+        ENTITY_SUBMIT(use_node);
+    }
+
     return import_node;
 }
 
index ca1a654a67dde991c8a1f293c83511b34a5f40aa..001d4fc87a7867f575cb2e6ea03a49316aca4b37 100644 (file)
@@ -1,7 +1,6 @@
 #load "core/std"
 
-#import core
-use core
+#import core {*}
 
 count_ending_paths :: (nums: [..] u32) -> u64 {
     tally := array.make(u64, nums.count);
index 8decca70c99fa0a903a179f4a7e249c75e0c1576..e57cbe519b4709b1d5a522a9c45d822d5685aa96 100644 (file)
@@ -1,6 +1,6 @@
 #load "core/std"
 
-use package core
+#import core {*}
 
 Ship :: struct {
     x : i32 = 0;
index ece1646c91a88748afa8d7dcec1698494fdfddba..f695a1d1fbd46bbf9f725eb0d23db056dfc2cb67 100644 (file)
@@ -1,6 +1,6 @@
 #load "core/std"
 
-use package core
+#import core {*}
 
 inv_mod :: (a_: i64, m_: i64) -> i64 {
     if m_ <= 1 do return 0;
index f031e09b740ff3b66022ddf560ccc5a9dd1d78a6..37828521bdf7c5bd19d1ae2ae039880518f9575d 100644 (file)
@@ -1,6 +1,6 @@
 #load "core/std"
 
-use package core
+#import core {*}
 
 MASK_SIZE :: 36
 Bitmask :: [MASK_SIZE] u8;
index 1d543650c6086a2259b1f8617b42162140e1dec0..7679508725dbef402b3a77f568d3ab752f7e9f3b 100644 (file)
@@ -1,6 +1,6 @@
 #load "core/std"
 
-use package core
+#import core {*}
 
 initial_numbers := u32.[ 1, 20, 8, 12, 0, 14 ];
 
index d1c2911788b2362aa9f7f39f9d35233322777a8c..1e3be230945ef74b65d71798d9353f5c1db11bde 100644 (file)
@@ -1,6 +1,6 @@
 #load "core/std"
 
-use package core
+#import core {*}
 
 Field :: struct {
        name : str = "";
index f690de0d45e550f9ed3544d8ff416c048921c3b5..70d9206d79f3ae62fec353b75cb29e9f8bb6a039 100644 (file)
@@ -1,6 +1,6 @@
 #load "core/std"
 
-use package core
+#import core {*}
 
 parse_factor :: (file: &str) -> u64 {
        string.strip_leading_whitespace(file);
index da06eabb4e4505d085d501eba2567a56fe17b285..62907f7ae2ad8936beae359205690199e57a6578 100644 (file)
@@ -1,6 +1,6 @@
 #load "core/std"
 
-use package core
+#import core {*}
 
 // nt -> t
 Term :: struct {
index d523ac1a1e88e4b8e7c6a1129241724196722237..6d0f8cfdb2ba4d206ad296f11495ca047a36d5db 100644 (file)
@@ -2,7 +2,7 @@ package main
 
 #load "core/std"
 
-use package core
+#import core {*}
 
 main :: (args: [] cstr) {
     contents := #file_contents "./tests/aoc-2020/input/day2.txt";
index c116d7130a1f538ce9b4a93bc90a3e03d6f8e459..58f8be71a11bd573014c217322d43b9a36c211ed 100644 (file)
@@ -1,6 +1,6 @@
 #load "core/std"
 
-use package core
+#import core {*}
 
 TILE_DATA_WIDTH  :: 10
 TILE_DATA_HEIGHT :: 10
index 01fdfedf7ed8c84b2ac41dc9b81005204ee27fc6..791bca1983e8eaae12b8d6fa87c349b9f0cf8ac7 100644 (file)
@@ -1,6 +1,6 @@
 #load "core/std"
 
-use package core
+#import core {*}
 
 /*
        What questions the data layout needs to answer easily:
index fdbbf7b3480839c046320f8db9e76219f65a2d42..69a73ee7a183feac611a19bcad52dcae841ddd91 100644 (file)
@@ -1,6 +1,6 @@
 #load "core/std"
 
-use package core
+#import core {*}
 
 key_arena : alloc.arena.ArenaState;
 key_alloc : Allocator;
index 6440e6ddc0ade53e580fae6920fb9dcd32fb1ccd..24973d9d04da8eeb9a647cc53d95fe4c7a90ae34 100644 (file)
@@ -1,6 +1,6 @@
 #load "core/std"
 
-use package core
+#import core {*}
 
 cups : [..] i32;
 
index 06367a2de280c131081021367d90adaede5c7347..2b930623691b397f272e9c8087d116ed26fcbd1b 100644 (file)
@@ -1,6 +1,6 @@
 #load "core/std"
 
-use package core
+#import core {*}
 
 Vec2 :: struct {
        x: i32 = 0;
index 60f7fee3a175cd53c97eb772793a6e07026e3b29..0f0078e0fd0e667c4093e4a8a84308e4da41ea90 100644 (file)
@@ -1,6 +1,6 @@
 #load "core/std"
 
-use package core
+#import core {*}
 
 power_mod :: (base: u32, exp: u32, mod: u32) -> u32 {
     t: u64 = 1;
index 7eb37a47f10f8bf0a278d2a326d964175b530e4b..2b03522c7f060b11a086ed0053597e4aab07fb92 100644 (file)
@@ -1,6 +1,6 @@
 #load "core/std"
 
-use package core
+#import core {*}
 
 Point :: struct {
     x, y : i32;
index bb2a01db25b1934b67a2599256c2ff19ba8c6b49..089934f05aa411713680ae98524f01515cf0b9b3 100644 (file)
@@ -1,6 +1,6 @@
 #load "core/std"
 
-use package core
+#import core {*}
 
 // Returns the number of fields
 process_passport :: (contents: &str) -> u32 {
index b2adef1964f685bbd6b637716ad1a37115e2ee20..7fdb64ec537bc538c2420b1fa164b84edd7c7303 100644 (file)
@@ -1,6 +1,6 @@
 #load "core/std"
 
-use package core
+#import core {*}
 
 main :: (args: [] cstr) {
     contents := #file_contents "./tests/aoc-2020/input/day5.txt";
index c79d69a4143cbfa7e35b7a66cccc9e018b19c79c..5835e20ad2546a94d36bd1376905796f025676c6 100644 (file)
@@ -1,6 +1,6 @@
 #load "core/std"
 
-use package core
+#import core {*}
 
 part_1 :: (contents: &str) -> u32 {
     chars : [26] bool;
index fb9055e37de0aec11b9fd4fdcf23ef6b9ac00746..eaccf47757749acee38f60be16bfc695f3fdf21b 100644 (file)
@@ -1,6 +1,6 @@
 #load "core/std"
 
-use package core
+#import core {*}
 
 BagGraph :: struct {
     nodes    : [..] &BagNode;
index e9e1bd6e764935dcf99b1771202c3f55d27bc4d0..92c5417b4d365889c567d0f8dac1eaff5372394e 100644 (file)
@@ -1,6 +1,6 @@
 #load "core/std"
 
-use package core
+#import core {*}
 
 OpCode :: enum (u16) {
     Nop; Acc; Jmp;
index 9e619c32ff5bacfddaa7453af84120e10877654d..9e869b6af472f9ac867a8d47f695c68061495232 100644 (file)
@@ -1,6 +1,6 @@
 #load "core/std"
 
-use package core
+#import core {*}
 
 find_contiguous_subarray_with_sum :: (nums: [..] u64, sum: u64) -> (i32, i32) {
     start := 0;
index 838b3e5f60481e346261d29524beeca9b113d578..e227592ddb11de3fff83c75310d44405dd77d60a 100644 (file)
@@ -1,6 +1,8 @@
 #load "core/std"
 
-use package core
+#import core.io
+#import core.os
+#import core {printf}
 
 count_increasing :: (arr: [] $T) -> u32 {
     increased_count := 0;
index 9c0c55ac4ab2853022d7a2ce12ca56af252de203..34c353efc2ba6a072dc9ab7637af96f89d3c6ece 100644 (file)
@@ -1,8 +1,6 @@
 PART :: 2
 
-#load "core/std"
-
-use package core
+#import core {*}
 
 main :: (args) => {
     for file: os.with_file("tests/aoc-2021/input/day02.txt") {
index 7510252e818b5175e3a3aad480626975b1b0a0c5..fcaa57a80e7f8c6bf687962cf3f23963d3d76781 100644 (file)
@@ -2,7 +2,7 @@ PART :: 2
 
 #load "core/std"
 
-use package core
+#import core {*}
 
 read_binary :: (r: &io.Reader) -> i32 {
     n := 0;
index 4d639b2be773b92e8161e9266580754c22085717..0bf7f8e23e5435386a9a6a5837b45e44f4ac9ea5 100644 (file)
@@ -1,6 +1,6 @@
 #load "core/std"
 
-use package core
+#import core {*}
 
 Cell :: u8
 
index 47d68fb9da48779e37c95add53327dd9d8845fc3..eadadbec83dd793d113b4fc465007c9eed6380f2 100644 (file)
@@ -1,6 +1,6 @@
 #load "core/std"
 
-use package core
+#import core {*}
 
 Line :: struct {
     x1, y1: i32;
index 37c607e6bf91fef9efe996102980dd16b7325b71..8dfe61b906d486d49c7356b6b021dcfccd3342fa 100644 (file)
@@ -1,6 +1,6 @@
 #load "core/std"
 
-use package core
+#import core {*}
 
 main :: (args) => {
     for file: os.with_file("./tests/aoc-2021/input/day06.txt") {
index 452cd1e5257e7fd35dba731bb710c292437b047d..3d7bfadacf78a9f9b211ec9b1b9c9dadef8ebe71 100644 (file)
@@ -1,6 +1,6 @@
 #load "core/std"
 
-use package core
+#import core {*}
 
 main :: (args) => {
     for file: os.with_file("./tests/aoc-2021/input/day07.txt") {
index e6dbc76236da352051a5ddaf797806ff79e0566c..9c89487a66db19557b8673aabe07b018f014c68c 100644 (file)
@@ -1,7 +1,7 @@
 PART :: 2
 #load "core/std"
 
-use package core
+#import core {*}
 
 // Encoded segments
 //
index f954a54a6aab375fe8559e4bb2456faed3b463e2..83e438d1a09239ef9f41492f5e4c241048ffe4ba 100644 (file)
@@ -1,6 +1,6 @@
 #load "core/std"
 
-use package core
+#import core {*}
 
 Pos :: struct {x,y: i32;}
 #match hash.to_u32 (use p: Pos) => x * 13 & 17 * y;
index ab81073090dfe90c288195ba19668c7fb0f22246..7a3da0bc3cfb8f666caa96ca39203530d6238595 100644 (file)
@@ -1,6 +1,6 @@
 #load "core/std"
 
-use package core
+#import core {*}
 
 main :: (args) => {
     for file: os.with_file("./tests/aoc-2021/input/day10.txt") {
index 59451f9dd6041368272e0e8feb98fb54c12afa69..9baff8355b1e7193ef606665aba1b50c4f82fc3b 100644 (file)
@@ -1,6 +1,6 @@
 #load "core/std"
 
-use package core
+#import core {*}
 
 Pos :: struct {x, y:i32;}
 #match hash.to_u32 (use p: Pos) => x * 45238271 + y * 34725643;
index a525d8552d97e521c3f4b43f1da329a1b988b9bf..8d42a94b4ba77b217b7526ac1875cc31a0492611 100644 (file)
@@ -1,6 +1,6 @@
 #load "core/std"
 
-use package core
+#import core {*}
 
 Communative_Pair :: struct (T: type_expr) where hash.Hashable(T) {
     a, b: T;
index 7876fb0256313bff684dc5a7a1ea07fe32e0d723..b1dcf4d9683d26fa4ca9cfdab1c2f112047f7539 100644 (file)
@@ -1,6 +1,6 @@
 #load "core/std"
 
-use package core
+#import core {*}
 
 Point :: struct {
     x, y: i32;
index aa4e33613a2a1602233ff25a6a163f656e240563..843e95d0a6cae4abcc24748954a723a7b2b9250d 100644 (file)
@@ -1,6 +1,6 @@
 #load "core/std"
 
-use package core
+#import core {*}
 
 Rule :: struct {
     pair: Pair(u8, u8);
index c05ca03182246a3ec1fd7e57c2a4240b6c024037..9fd783cbb942b742ac2b16ec624ac2e86ce8a234 100644 (file)
@@ -1,6 +1,6 @@
 #load "core/std"
 
-use package core
+#import core {*}
 
 queued :: struct { x, y: i32; cost: i32; };
 #operator == (u1, u2: queued) => u1.x == u2.x && u1.y == u2.y;
index 941d4abdd6e69ae1a66b859b2289cc3c5287d518..afbbe24d8c4f48fd9ad4bd65fec2cf7f140a48ae 100644 (file)
@@ -1,6 +1,6 @@
 #load "core/std"
 
-use package core
+#import core {*}
 
 base16_to_hex :: (s: str) -> u32 {
     res := 0;
index 529bfbba3fd02cac13dcf3545799375db594c4b3..cd917f69b9f97ca5e08d137ecec976586f79ae21 100644 (file)
@@ -1,6 +1,6 @@
 #load "core/std"
 
-use package core
+#import core {*}
 
 tx0: i32
 ty0: i32
index de454d5482c4a173bda4f7e7121aad78fac64d7c..a71847766164e30899f1bd6745fbd3c7fb01c14b 100644 (file)
@@ -1,6 +1,6 @@
 #load "core/std"
 
-use package core
+#import core {*}
 
 Vec2 :: struct { x: i32; y: i32; }
 
index 2bc907619e2767f1db3e922c414ba61b450ee4f0..4eb7fd17725a02da864ec6e5dd26ffcd087a7ea0 100644 (file)
@@ -1,8 +1,8 @@
 #load "core/std"
 #load "core/intrinsics/atomics"
 
-use package core
-use package core.intrinsics.atomics
+#import core {*}
+#import core.intrinsics.atomics {*}
 
 Shared_Data :: struct {
     arr: [] i32;
index 186c01b42fb5efb879259102f5ae4c286dc66901..2a38250ed9f7791e6889c5cab9ac66ae799b4eaa 100644 (file)
@@ -1,6 +1,6 @@
 #load "core/std"
 
-use package core
+#import core {*}
 
 dumb :: (it: Iterator, m: &Map) {
     println(it.Iter_Type);
index ab818a3a0ac0363239aa0e8bfe3071182f3438e6..6575cde05a3e0eb0bd5ea7bf30db2928794b5017 100644 (file)
@@ -1,6 +1,6 @@
 #load "core/std"
 
-use package core
+#import core {*}
 
 main :: () {
     tree: &avl_tree.AVL_Tree(i32);
index eaf0d6034bcc8938d9a98e1f00a4ef38ceebdfb5..f43a71597dac349993b40ff2579d30ad42ac37af 100644 (file)
@@ -1,6 +1,6 @@
 #load "core/std"
 
-use package core
+#import core {*}
 
 count_to :: ($N: i32) {
     for i: 0 .. N do printf("{} ", i);
index df0fe17f98bc6a936e452b1442b33a4badc5d1ff..f46d20f40514d6bbbc31bad354fcafa252f9e092 100644 (file)
@@ -1,6 +1,6 @@
 #load "core/std"
 
-use package core
+#import core {*}
 
 Foo :: struct {
     x, y: i32;
index 3e06092ac8c147c58cdcd3bf0dbe861db5a62da9..85ca86011a39ea382ab78d8b6720fe8ee45d54bb 100644 (file)
@@ -1,6 +1,6 @@
 #load "core/std"
 
-use package core
+#import core {*}
 
 main :: (args: [] cstr) {
     ba := bucket_array.make(i32, 4);
index 81a8d338815b2349f9fbc0ebbf2d0a97db086eb6..519d7c95ce8c00b2b9a09a23a4fedaf0ad1aa93f 100644 (file)
@@ -1,6 +1,6 @@
 #load "core/std"
 
-use package core
+#import core {*}
 
 S :: struct {
     some_array: [..] struct {
index 091f6e31e7287794175b028a5b6111fe89e1c430..46aac22ba843b0afb8922e1b718b1fdac59dadf9 100644 (file)
@@ -1,6 +1,6 @@
 #load "core/std"
 
-use package core
+#import core {*}
 
 test_macro :: macro () {
     defer {
index f57c9a780040825d11b21fc932a66f38585f4e8e..2d2a001f7968d8adbe09d814932cdfc0949475da 100644 (file)
@@ -1,6 +1,6 @@
 #load "core/std"
 
-use package core
+#import core {*}
 
 custom_iterator :: () -> Iterator(i32) {
 
index 691ed8fb10d2a4c5c8edc2e93d14abba4d2b6fb6..38f1865b5f3059e0e787b505c72c2f87fbb1e248 100644 (file)
@@ -1,6 +1,6 @@
 #load "core/std"
 
-use package core
+#import core {*}
 
 Point :: struct { x, y: i32; }
 
index 94582312155ba78f37b4d9f0ee688deed37ebe29..519d8a311eee6f15bb2e9b12b1bc185a165b99ee 100644 (file)
@@ -1,5 +1,5 @@
 #load "core/std"
-use package core
+#import core {*}
 
 SomeNamespace :: struct {
     foo :: () {
index fe27a40c431957b6cd46e740da0bb3bd21b6dbce..91615d4457b421ccf7341469f9b881a8041fb06c 100644 (file)
@@ -1,6 +1,6 @@
 #load "core/std"
 
-use package core
+#import core {*}
 
 using_callsite :: (value: $T, site := #callsite) {
     println(value);
@@ -25,4 +25,4 @@ Something :: struct {
     }
 }
 
-#local runtime :: package runtime
+#import runtime
index c9f6e6560c88ef6c76744602623d69c76e5c6d6a..88d3f130f516abc759c1cae9fca93d733c41776c 100644 (file)
@@ -1,6 +1,6 @@
 #load "core/std"
 
-use package core
+#import core {*}
 
 Test_VTable :: struct {
     first  : (i32) -> i32;
index 9c985dfb8e9013fb5f8132c3fa10d67c40ba6f8c..e28c1ad772bc2c5e7d154d8efead90750f0b7e22 100644 (file)
@@ -1,6 +1,6 @@
 #load "core/std"
 
-use package core
+#import core {*}
 
 main :: (args: [] cstr) {
     baked_proc :: (x: $T, $func: (T) -> typeof x) -> T {
index 6594a51a61e3f997ae6a4ee9259a078b0ff8fb5b..bbf58fff8f3a60110a7433177c3c62f15adaee92 100644 (file)
@@ -1,6 +1,6 @@
 #load "core/std"
 
-use package core
+#import core {*}
 
 main :: (args: [] cstr) {
     defer println("At the end!");
index 3cc44f552f05c7a19b40c3fee06ca492d0f82f1b..fffb58520e89946927455cb49a806ca0e9146901 100644 (file)
@@ -1,6 +1,6 @@
 #load "core/std"
 
-use package core
+#import core {*}
 
 main :: (args: [] cstr) {
     println(#defined(stdio));
index 3d31942eef41095e8fea32858743681d2149668d..4e3ac070a9e3a4e848dc7e938a43f917b30cff23 100644 (file)
@@ -1,6 +1,6 @@
 #load "core/std"
 
-use package core
+#import core {*}
 
 main :: (args: [] cstr) {
 
index db403f7672ec6630d5301f0de573e9e06e3fe736..a8e06d5f7dbfad97064b8ed431e0c2fd88f3f6b3 100644 (file)
@@ -2,7 +2,7 @@ package main
 
 #load "core/std"
 
-use package core
+#import core {*}
 
 main :: (args: [] cstr) {
     imap : Map(i32, str);
index 677bd23f677052322dc16d43c4b362ac18a2b06a..4c099ce2252b1dc79fa372f3aa992c006eb3cbd7 100644 (file)
@@ -1,6 +1,6 @@
 #load "core/std"
 
-use package core
+#import core {*}
 
 main :: (args) => {
     {
index 225075aa4ee9db37def9dc402aca2991142c2a73..b5ba5a324c49f96943ba186f7b2047672f9aab61 100644 (file)
@@ -1,6 +1,6 @@
 #load "core/std"
 
-use package core
+#import core {*}
 
 first_init :: #init #after second_init () {
     println("In an #init proc.");
index 8f6fff7dab521a8dd558680f5401c93b91d07405..604cfabaa6ee376d7eb7211f03e3039a985945eb 100644 (file)
@@ -1,6 +1,6 @@
 #load "core/std"
 
-use package core
+#import core {*}
 
 count_iterator :: (lo: $T, hi: T, step: T = 1) -> Iterator(T) {
     return iter.generator(
index 36eb0506e562303cdc49774beb7b90bd5f71eb54..26bd8e0542c298ee3994862fffd4c225848c0203 100644 (file)
@@ -1,6 +1,6 @@
 #load "core/std"
 
-use package core
+#import core {*}
 
 main :: (args: [] cstr) {
     foo :: (x: i32, y: f32) {
index 07711f83df5754749fb091c39c7c07cfbd5019c1..2887e871207ae71bd444affee0c8336d8e5aaec1 100644 (file)
@@ -1,7 +1,7 @@
 #load "core/std"
 
-#import core
+#import core {printf, map}
 
 main :: (args: [] cstr) {
-    core.printf("{} {} {{}} {} {.1} {.5} {}\n", 123, "Test", false, 12.34, 12.3456789, [..] map.Map(i32, str));
+    printf("{} {} {{}} {} {.1} {.5} {}\n", 123, "Test", false, 12.34, 12.3456789, [..] map.Map(i32, str));
 }
index 5bd6382d25657cb13b8a379114a87caf7b90da6d..ac00bb4e43e3840997a628a506152ae0bc5d4b6b 100644 (file)
@@ -2,7 +2,7 @@
 
 #load "core/std"
 
-use package core
+#import core {*}
 
 
 Vec3 :: struct {
index 2bf51ab6cc1c479839eb59438ec000e01101b922..72df514955e3746d9d3040c5e25a243555d0696b 100644 (file)
@@ -1,6 +1,6 @@
 #load "core/std"
 
-use package core
+#import core {*}
 
 Complex :: struct {
     re : f32 = 0;
index 07f4197caf0a431f7b29d83264a9198b0b262c1b..54752d7096de1c4bbf37d6b193979086ad361e1b 100644 (file)
@@ -1,6 +1,6 @@
 #load "core/std"
 
-use package core
+#import core {*}
 
 overloaded :: #match {
     #order 10 (x: i32) { println("Option X"); },
index 835dab2faf8f30141729cfd3ff8217f75b1b87d2..7902615dafd504b28ed37312888a844df606d8ab 100644 (file)
@@ -2,7 +2,7 @@
 
 #load "core/std"
 
-use package core
+#import core {*}
 
 
 main :: (args: [] cstr) {
index 6a02256899fdda6058ef518855b95436442445ab..bd58c0c85acea5abe55df402336f892d9b2d5350 100644 (file)
@@ -1,6 +1,7 @@
 #load "core/std"
-use package core
-info :: package runtime.info
+
+#import core {*}
+#import runtime.info
 
 Base :: struct (T: type_expr) {
     const: i32;
index 21d6b93263ae304420df30429b746ccf4e0cd913..f865277a0bd71b7c6692aa70e7fcde37319e321b 100644 (file)
@@ -1,6 +1,6 @@
 #load "core/std"
 
-use package core
+#import core {*}
 
 main :: (args: [] cstr) {
     NewPolyStruct :: struct (T: type_expr, N: i32) {
index 8ec8c4a33a2c3c3e895dcc08c2c2cb420308eaad..526102b133794f3bca519f43084dfaa773cef1aa 100644 (file)
@@ -1,6 +1,6 @@
 #load "core/std"
 
-use package core
+#import core {*}
 
 main :: (args: [] cstr) {
     arr := u32.[ 1, 2, 3, 4, 5 ];
index be9290782234448e565fd511f85317f52612720a..398e37a0a5762b9780a2331d3a8fdd83a958d311 100644 (file)
@@ -1,6 +1,6 @@
 #load "core/std"
 
-use package core
+#import core {*}
 
 main :: (args) => {
     x: [..] i32;
index bea6234f344b4301b3f639c39fcb9df8e073b080..4d435566868073a65e26d385de1885081d15ef8a 100644 (file)
@@ -1,6 +1,6 @@
 #load "core/std"
 
-use package core
+#import core {*}
 
 main :: (args: [] cstr) {
 
index 43165758f25b059a233c31ff3bbb2333d3b81f79..410d99c40665724deab769efe155206f8cd7a5e9 100644 (file)
@@ -1,6 +1,6 @@
 #load "core/std"
 
-use package core
+#import core {*}
 
 main :: (args: [] cstr) {
 
index a280651303bb9405bbbe8a2189ca19754e16a20c..51925dd1ca32cebabb38841219ca03af62cd8414 100644 (file)
@@ -1,5 +1,5 @@
 #load "core/std"
-use package core
+#import core {*}
 
 Person_Vtable :: struct {
     greet: (&Person) -> void;
index 9eb512e9c9a6909d3ad14e3f54111742340d433c..6443aa05aa7ded291ede3657b7588944f5de613d 100644 (file)
@@ -1,6 +1,6 @@
 #load "core/std"
 
-use package core
+#import core {*}
 
 Vector2 :: struct { x, y: i32; }
 #operator == macro (v1: Vector2, v2: Vector2) => v1.x == v2.x && v1.y == v2.y;
index 34ca9c551366603132a13430ebf67b54d56896ed..c6ceac85965e949dad96254b4f1a0b11f7a723b7 100644 (file)
@@ -2,7 +2,7 @@ package main
 
 #load "core/std"
 
-use package core;
+#import core {*};
 
 old_va_test :: (prefix: str, va: ..i32) {
     println(prefix);