From: Brendan Hansen Date: Mon, 27 Mar 2023 00:05:06 +0000 (-0500) Subject: removed: `#import` statement. repurposed `use` statement entirely X-Git-Url: https://git.brendanfh.com/?a=commitdiff_plain;h=e4af97100094e25e56e5a49a4650f562f863cef5;p=onyx.git removed: `#import` statement. repurposed `use` statement entirely --- diff --git a/compiler/src/parser.c b/compiler/src/parser.c index c2394d4c..45779b35 100644 --- a/compiler/src/parser.c +++ b/compiler/src/parser.c @@ -1691,13 +1691,6 @@ static AstNode* parse_statement(OnyxParser* parser) { break; } - if (parse_possible_directive(parser, "import")) { - // :LinearTokenDependent - parse_import_statement(parser, parser->curr - 2); - needs_semicolon = 0; - break; - } - if (next_tokens_are(parser, 2, '#', Token_Type_Symbol)) { retval = (AstNode *) parse_factor(parser); break; @@ -3499,10 +3492,6 @@ static void parse_top_level_statement(OnyxParser* parser) { expect_token(parser, Token_Type_Literal_String); return; } - else if (parse_possible_directive(parser, "import")) { - parse_import_statement(parser, dir_token); - return; - } else { OnyxToken* directive_token = expect_token(parser, '#'); OnyxToken* symbol_token = parser->curr; @@ -3620,6 +3609,10 @@ static void parse_import_statement(OnyxParser* parser, OnyxToken *token) { package_node->type_node = builtin_package_id_type; package_node->token = token; + if (peek_token(0)->type == Token_Type_Keyword_Package) { + package_node->token = expect_token(parser, Token_Type_Keyword_Package); + } + if (!parse_package_name(parser, package_node)) return; AstImport *import_node = make_node(AstImport, Ast_Kind_Import); diff --git a/core/alloc/arena.onyx b/core/alloc/arena.onyx index 311237e7..e155800d 100644 --- a/core/alloc/arena.onyx +++ b/core/alloc/arena.onyx @@ -1,6 +1,6 @@ package core.alloc.arena -#import core +use core // This allocator is mostly used for making many fixed-size // allocation (i.e. allocations that will not need to change diff --git a/core/alloc/atomic.onyx b/core/alloc/atomic.onyx index d91fd8ec..ce4bad90 100644 --- a/core/alloc/atomic.onyx +++ b/core/alloc/atomic.onyx @@ -6,7 +6,7 @@ package core.alloc.atomic // is not needed for the general purpose heap allocator, // as that already has a thread-safe implementation. -#import core.sync +use core.sync AtomicAllocator :: struct { a: Allocator; diff --git a/core/alloc/fixed.onyx b/core/alloc/fixed.onyx index b87c6bb9..261ce258 100644 --- a/core/alloc/fixed.onyx +++ b/core/alloc/fixed.onyx @@ -1,6 +1,6 @@ package core.alloc.fixed -#import core +use core // This allocator is very simple and always returns the same pointer, // unless too much memory is asked for, in which case it returns null. diff --git a/core/alloc/gc.onyx b/core/alloc/gc.onyx index 103128da..293222b8 100644 --- a/core/alloc/gc.onyx +++ b/core/alloc/gc.onyx @@ -16,7 +16,7 @@ package core.alloc.gc // // Every allocation here will automatically be freed // } -#import core +use core GCState :: struct { backing_allocator: Allocator; diff --git a/core/alloc/heap.onyx b/core/alloc/heap.onyx index e80a8b87..7ef8932e 100644 --- a/core/alloc/heap.onyx +++ b/core/alloc/heap.onyx @@ -1,7 +1,7 @@ package core.alloc.heap -#import runtime -#import core +use runtime +use core // This is the implementation for the general purpose heap allocator. diff --git a/core/alloc/logging.onyx b/core/alloc/logging.onyx index 647a7ba2..937a2561 100644 --- a/core/alloc/logging.onyx +++ b/core/alloc/logging.onyx @@ -4,7 +4,7 @@ package core.alloc.log // prints every allocation/deallocation made by that // allocator. -#import core +use core #local Allocation_Action_Strings := str.[ diff --git a/core/alloc/pool.onyx b/core/alloc/pool.onyx index 30fb47be..4677c6ba 100644 --- a/core/alloc/pool.onyx +++ b/core/alloc/pool.onyx @@ -1,6 +1,6 @@ package core.alloc.pool -#import core +use core // A pool allocator is an O(1) allocator that is capable of allocating and freeing. // It is able to do both in constant time because it maintains a linked list of all diff --git a/core/alloc/ring.onyx b/core/alloc/ring.onyx index f5888791..2111e5d0 100644 --- a/core/alloc/ring.onyx +++ b/core/alloc/ring.onyx @@ -1,6 +1,6 @@ package core.alloc.ring -#import core +use core // This allocator is great for temporary memory, such as returning // a pointer from a function, or storing a formatted string. The diff --git a/core/builtin.onyx b/core/builtin.onyx index 3c92bfe3..8885c70a 100644 --- a/core/builtin.onyx +++ b/core/builtin.onyx @@ -1,6 +1,6 @@ package builtin -#import runtime +use runtime // // Explanation of `package builtin` diff --git a/core/container/array.onyx b/core/container/array.onyx index 0c8bd020..fd19385b 100644 --- a/core/container/array.onyx +++ b/core/container/array.onyx @@ -1,6 +1,6 @@ package core.array -#import core +use core // [..] T == Array(T) // where diff --git a/core/container/avl_tree.onyx b/core/container/avl_tree.onyx index 50d42e51..f9513684 100644 --- a/core/container/avl_tree.onyx +++ b/core/container/avl_tree.onyx @@ -1,7 +1,7 @@ package core.avl_tree -#import core -#import core.math +use core +use core.math AVL_Tree :: struct (T: type_expr) { data: T; diff --git a/core/container/bucket_array.onyx b/core/container/bucket_array.onyx index b02cd2dc..f50d1545 100644 --- a/core/container/bucket_array.onyx +++ b/core/container/bucket_array.onyx @@ -2,9 +2,9 @@ package core.bucket_array -#import core -#import core.array -#import core.iter +use core +use core.array +use core.iter Bucket_Array :: struct (T: type_expr) { allocator : Allocator; diff --git a/core/container/heap.onyx b/core/container/heap.onyx index eb29ff6a..3ff0837d 100644 --- a/core/container/heap.onyx +++ b/core/container/heap.onyx @@ -1,6 +1,6 @@ package core.heap -#import core.array +use core.array Heap :: struct (T: type_expr) { data: [..] T; diff --git a/core/container/iter.onyx b/core/container/iter.onyx index f448850b..1638648e 100644 --- a/core/container/iter.onyx +++ b/core/container/iter.onyx @@ -1,10 +1,10 @@ package core.iter -#import core -#import core.memory -#import core.alloc -#import core.array -#import runtime +use core +use core.memory +use core.alloc +use core.array +use runtime use core {Pair} use core.intrinsics.types {type_is_struct} diff --git a/core/container/list.onyx b/core/container/list.onyx index 6fe72cf8..444e59ae 100644 --- a/core/container/list.onyx +++ b/core/container/list.onyx @@ -1,6 +1,6 @@ package core.list -#import core +use core ListElem :: struct (T: type_expr) { next: &ListElem(T) = null; diff --git a/core/container/map.onyx b/core/container/map.onyx index 926ea4ae..2d712b80 100644 --- a/core/container/map.onyx +++ b/core/container/map.onyx @@ -1,11 +1,11 @@ package core.map -#import core -#import core.array -#import core.hash -#import core.memory -#import core.math -#import core.conv +use core +use core.array +use core.hash +use core.memory +use core.math +use core.conv use core {Optional} use core.intrinsics.onyx { __initialize } diff --git a/core/container/result.onyx b/core/container/result.onyx index ea9ac23e..17d187ed 100644 --- a/core/container/result.onyx +++ b/core/container/result.onyx @@ -8,8 +8,8 @@ package core // helper methods that make it easier to work with Results. // -#import core -#import core.conv +use core +use core.conv use core {Optional} diff --git a/core/container/set.onyx b/core/container/set.onyx index 66584816..71f41fc8 100644 --- a/core/container/set.onyx +++ b/core/container/set.onyx @@ -1,10 +1,10 @@ package core.set -#import core -#import core.array -#import core.hash -#import core.memory -#import core.math +use core +use core.array +use core.hash +use core.memory +use core.math use core {Optional} diff --git a/core/conv/conv.onyx b/core/conv/conv.onyx index 8296a6fd..058d56cf 100644 --- a/core/conv/conv.onyx +++ b/core/conv/conv.onyx @@ -2,8 +2,8 @@ package core.conv Enable_Custom_Formatters :: true -#import core.string -#import core.math +use core.string +use core.math // // Converts a string into an integer. Works with positive and diff --git a/core/conv/parse.onyx b/core/conv/parse.onyx index e29fe465..b43b50d8 100644 --- a/core/conv/parse.onyx +++ b/core/conv/parse.onyx @@ -1,10 +1,10 @@ package core.conv -#import core.map -#import core.string -#import core.array -#import core.math -#import runtime +use core.map +use core.string +use core.array +use core.math +use runtime // // Parses many different types from a string into a value. diff --git a/core/encoding/base64.onyx b/core/encoding/base64.onyx index b455caab..b6f47cf3 100644 --- a/core/encoding/base64.onyx +++ b/core/encoding/base64.onyx @@ -1,6 +1,6 @@ package core.encoding.base64 -#import core.array +use core.array // // A simple Base64 encoding and decoding library. Currently diff --git a/core/encoding/csv.onyx b/core/encoding/csv.onyx index 954a7d94..a5afd72b 100644 --- a/core/encoding/csv.onyx +++ b/core/encoding/csv.onyx @@ -9,14 +9,14 @@ package core.encoding.csv // it ergonomic to work with. // -#import core -#import core.string -#import core.array -#import core.iter -#import core.conv -#import core.io -#import core.test -#import runtime +use core +use core.string +use core.array +use core.iter +use core.conv +use core.io +use core.test +use runtime use core.misc {any_as} use runtime.info { diff --git a/core/encoding/ini.onyx b/core/encoding/ini.onyx index fea0ff57..537123a3 100644 --- a/core/encoding/ini.onyx +++ b/core/encoding/ini.onyx @@ -32,10 +32,10 @@ package core.encoding.ini // display_name=Player // -#import core.alloc -#import core.conv -#import core.string -#import core.io +use core.alloc +use core.conv +use core.string +use core.io use core { aprintf } use core.intrinsics.types { type_is_struct } diff --git a/core/encoding/utf8.onyx b/core/encoding/utf8.onyx index 9313fb14..73a1e2e5 100644 --- a/core/encoding/utf8.onyx +++ b/core/encoding/utf8.onyx @@ -1,8 +1,8 @@ package core.encoding.utf8 -#import core.string -#import core.array -#import core.iter +use core.string +use core.array +use core.iter rune :: i32 diff --git a/core/intrinsics/atomics.onyx b/core/intrinsics/atomics.onyx index e10d26f7..0fea7817 100644 --- a/core/intrinsics/atomics.onyx +++ b/core/intrinsics/atomics.onyx @@ -1,7 +1,7 @@ package core.intrinsics.atomics #local { - #import runtime + use runtime #if !runtime.Multi_Threading_Enabled { #error "Multi-threading is not enabled so you cannot include the 'core.intrinsics.atomics' package." diff --git a/core/io/binary.onyx b/core/io/binary.onyx index 43396986..507760ad 100644 --- a/core/io/binary.onyx +++ b/core/io/binary.onyx @@ -1,6 +1,6 @@ package core.io -#import core.memory +use core.memory BinaryWriter :: struct { diff --git a/core/io/reader.onyx b/core/io/reader.onyx index 5c10fdd7..d7d506d7 100644 --- a/core/io/reader.onyx +++ b/core/io/reader.onyx @@ -8,10 +8,10 @@ package core.io // reader could not, like 'read the next line', // or 'read until a period'. -#import core.memory -#import core.math -#import core.array -#import core.iter +use core.memory +use core.math +use core.array +use core.iter Reader :: struct { stream: &Stream; diff --git a/core/io/stdio.onyx b/core/io/stdio.onyx index 4d313039..4f5e8fa1 100644 --- a/core/io/stdio.onyx +++ b/core/io/stdio.onyx @@ -6,7 +6,7 @@ // in anyway. package core -#import runtime +use runtime // diff --git a/core/io/writer.onyx b/core/io/writer.onyx index 8006f036..f01b57e4 100644 --- a/core/io/writer.onyx +++ b/core/io/writer.onyx @@ -1,8 +1,8 @@ package core.io -#import core.conv -#import core.string -#import core.memory +use core.conv +use core.string +use core.memory // io.Writer is a buffered-writer. The important thing to not forget // when using io.Writer is that it has to be flushed when you are done diff --git a/core/misc/any_utils.onyx b/core/misc/any_utils.onyx index c1850f9b..b48ad3fd 100644 --- a/core/misc/any_utils.onyx +++ b/core/misc/any_utils.onyx @@ -1,9 +1,9 @@ package core.misc -#import runtime -#import core.iter -#import core.array -#import core.string +use runtime +use core.iter +use core.array +use core.string use runtime.info { get_type_info, diff --git a/core/net/tcp.onyx b/core/net/tcp.onyx index bb0f64cb..b2685f41 100644 --- a/core/net/tcp.onyx +++ b/core/net/tcp.onyx @@ -4,14 +4,14 @@ package core.net #error "Cannot include this file. Platform not supported."; } -#import core.sync -#import core.thread -#import core.array -#import core.memory -#import core.alloc -#import core.os -#import core.iter -#import runtime +use core.sync +use core.thread +use core.array +use core.memory +use core.alloc +use core.os +use core.iter +use runtime #if !runtime.Multi_Threading_Enabled { #error "Expected multi-threading to be enabled for TCP server."; diff --git a/core/onyx/cbindgen.onyx b/core/onyx/cbindgen.onyx index 7a225e2f..66d8ba5d 100644 --- a/core/onyx/cbindgen.onyx +++ b/core/onyx/cbindgen.onyx @@ -41,8 +41,8 @@ package cbindgen #if #defined (runtime.Generated_Foreign_Info) { -#import core -#import runtime +use core +use runtime #if runtime.compiler_os == .Linux { #if #defined (runtime.vars.CC) { diff --git a/core/onyx/cptr.onyx b/core/onyx/cptr.onyx index 210a2fb1..49bd8866 100644 --- a/core/onyx/cptr.onyx +++ b/core/onyx/cptr.onyx @@ -70,7 +70,7 @@ cptr :: struct (T: type_expr) { // to the same idea as 'null' in Onyx. if this.data == 0 do return null; - #import core.intrinsics.wasm + use core.intrinsics.wasm // Using 1 instead of 0 because a null pointer (0) converts // to the memory address 0, not the base address for the WASM // memory. diff --git a/core/os/dir.onyx b/core/os/dir.onyx index 7ac13fcd..903c14bb 100644 --- a/core/os/dir.onyx +++ b/core/os/dir.onyx @@ -4,8 +4,8 @@ package core.os #error "Cannot include this file. Platform not supported."; } -#import core.string -#import runtime +use core.string +use runtime #local fs :: runtime.platform diff --git a/core/os/os.onyx b/core/os/os.onyx index 7f07dce0..53080faa 100644 --- a/core/os/os.onyx +++ b/core/os/os.onyx @@ -1,6 +1,6 @@ package core.os -#import runtime +use runtime #if !runtime.platform.Supports_Os { #error "Cannot include this file. Platform not supported."; diff --git a/core/os/process.onyx b/core/os/process.onyx index a4a55138..6a6e60e2 100644 --- a/core/os/process.onyx +++ b/core/os/process.onyx @@ -4,8 +4,8 @@ package core.os #error "Cannot include this file. Platform not supported."; } -#import core.io -#import runtime +use core.io +use runtime use runtime.platform { __process_spawn, diff --git a/core/random/random.onyx b/core/random/random.onyx index 1431dfa7..6fbcfcb6 100644 --- a/core/random/random.onyx +++ b/core/random/random.onyx @@ -1,6 +1,6 @@ package core.random -#import core +use core // // The state of a random number generator. @@ -54,7 +54,7 @@ Random :: struct { // Returns a random string of length `bytes_long`. If `alpha_numeric` is // true, then the string will only consist of alpha-numeric characters. string :: (self: &Random, bytes_long: u32, alpha_numeric := false, allocator := context.allocator) -> str { - #import core.memory + use core.memory s := memory.make_slice(u8, bytes_long, allocator=allocator); for& s { diff --git a/core/runtime/info/helper.onyx b/core/runtime/info/helper.onyx index bae2f9aa..50823014 100644 --- a/core/runtime/info/helper.onyx +++ b/core/runtime/info/helper.onyx @@ -1,7 +1,7 @@ package runtime.info -#import core -#import core.io +use core +use core.io write_type_name :: (writer: &io.Writer, t: type_expr) { info := get_type_info(t); @@ -331,7 +331,7 @@ populate_struct_vtable :: (table: &$Table_Type, struct_type: type_expr, safe := } for_all_types :: macro (body: Code) { - #import runtime + use runtime for runtime.info.type_table.count { type_info := runtime.info.type_table[it]; diff --git a/core/runtime/info/proc_tags.onyx b/core/runtime/info/proc_tags.onyx index 234d7925..6472e135 100644 --- a/core/runtime/info/proc_tags.onyx +++ b/core/runtime/info/proc_tags.onyx @@ -1,7 +1,7 @@ package runtime.info -#import core.array +use core.array tagged_procedures: [] &Tagged_Procedure diff --git a/core/runtime/platform/onyx/fs.onyx b/core/runtime/platform/onyx/fs.onyx index 1056c716..63551dcf 100644 --- a/core/runtime/platform/onyx/fs.onyx +++ b/core/runtime/platform/onyx/fs.onyx @@ -1,6 +1,6 @@ package runtime.platform -#import core {*} +use core {*} FileData :: #distinct i64 DirectoryData :: #distinct u64 diff --git a/core/runtime/platform/wasi/env.onyx b/core/runtime/platform/wasi/env.onyx index 24d8f0e7..9a30284f 100644 --- a/core/runtime/platform/wasi/env.onyx +++ b/core/runtime/platform/wasi/env.onyx @@ -1,10 +1,10 @@ package core.env -#import runtime -#import core.map -#import core.memory -#import core.string -#import wasi +use runtime +use core.map +use core.memory +use core.string +use wasi #if runtime.runtime != .Wasi diff --git a/core/runtime/platform/wasi/platform.onyx b/core/runtime/platform/wasi/platform.onyx index 803f416a..ac8a8597 100644 --- a/core/runtime/platform/wasi/platform.onyx +++ b/core/runtime/platform/wasi/platform.onyx @@ -3,9 +3,9 @@ package runtime.platform #load "./wasi_defs" #load "./wasi_fs" -#import core -#import wasi -#import runtime +use core +use wasi +use runtime use core use wasi { diff --git a/core/runtime/platform/wasi/wasi_fs.onyx b/core/runtime/platform/wasi/wasi_fs.onyx index 6fcd7f33..c2dfe65a 100644 --- a/core/runtime/platform/wasi/wasi_fs.onyx +++ b/core/runtime/platform/wasi/wasi_fs.onyx @@ -1,8 +1,8 @@ package runtime.platform -#import runtime -#import core -#import wasi +use runtime +use core +use wasi use core diff --git a/core/std.onyx b/core/std.onyx index 996d19b4..b626a666 100644 --- a/core/std.onyx +++ b/core/std.onyx @@ -1,6 +1,6 @@ package core -#import runtime +use runtime #load "./alloc/alloc" diff --git a/core/string/buffer.onyx b/core/string/buffer.onyx index d235ed23..77690673 100644 --- a/core/string/buffer.onyx +++ b/core/string/buffer.onyx @@ -6,7 +6,7 @@ package core.string -#import core.math +use core.math String_Buffer :: struct { data : [&] u8; diff --git a/core/string/string.onyx b/core/string/string.onyx index 7f7a97e3..81736c81 100644 --- a/core/string/string.onyx +++ b/core/string/string.onyx @@ -652,45 +652,45 @@ bisect :: (s: str, substr: str) -> (str, str) { // to_dyn_str :: (x: str, allocator := context.allocator) -> dyn_str { - #import core.array + use core.array return array.make(x, allocator); } delete :: macro (x: &dyn_str, idx: u32) -> u8 { - #import core.array + use core.array return array.delete(x, idx); } append :: #match { macro (x: &dyn_str, other: str) { - #import core.array + use core.array array.concat(x, other); }, macro (x: &dyn_str, other: u8) { - #import core.array + use core.array array.push(x, other); }, } clear :: macro (x: &dyn_str) { - #import core.array + use core.array array.clear(x); } retreat :: macro (x: &dyn_str, chars := 1) { - #import core.array + use core.array array.pop(x, chars); } insert :: #match #locked { macro (x: &dyn_str, idx: u32, new_str: str) -> bool { - #import core.array + use core.array return array.insert(x, idx, new_str); }, macro (x: &dyn_str, idx: u32, ch: u8) -> bool { - #import core.array + use core.array return array.insert(x, idx, ch); } } diff --git a/core/string/string_pool.onyx b/core/string/string_pool.onyx index 200ddb28..ecf77ee1 100644 --- a/core/string/string_pool.onyx +++ b/core/string/string_pool.onyx @@ -1,8 +1,8 @@ package core.string -#import core.alloc -#import core.alloc.arena -#import core.memory +use core.alloc +use core.alloc.arena +use core.memory // // Many times, storing strings is annoying because you need diff --git a/core/sync/semaphore.onyx b/core/sync/semaphore.onyx index 66112573..c9c3d5e0 100644 --- a/core/sync/semaphore.onyx +++ b/core/sync/semaphore.onyx @@ -1,7 +1,7 @@ package core.sync -#import runtime -#import core +use runtime +use core use core.intrinsics.atomics diff --git a/core/test/testing.onyx b/core/test/testing.onyx index d47fd5b5..9ee93686 100644 --- a/core/test/testing.onyx +++ b/core/test/testing.onyx @@ -1,9 +1,9 @@ package core.test -#import core -#import core.array -#import core.string -#import runtime +use core +use core.array +use core.string +use runtime use core {printf} diff --git a/core/time/time.onyx b/core/time/time.onyx index 32581d2c..91d1bef0 100644 --- a/core/time/time.onyx +++ b/core/time/time.onyx @@ -1,9 +1,9 @@ package core.time -#import core -#import core.os -#import core.conv -#import runtime +use core +use core.os +use core.conv +use runtime use runtime.platform { __time_gmtime, diff --git a/examples/04_fixed_arrays.onyx b/examples/04_fixed_arrays.onyx index 393c3928..2ac9e93f 100644 --- a/examples/04_fixed_arrays.onyx +++ b/examples/04_fixed_arrays.onyx @@ -17,8 +17,7 @@ #load "core/std" -#import core -use core +use core {*} main :: (args: [] cstr) { // The following declares a fixed-size array of 10 i32s on the stack. Currently, diff --git a/examples/05_slices.onyx b/examples/05_slices.onyx index 085f1c51..66b0b22a 100644 --- a/examples/05_slices.onyx +++ b/examples/05_slices.onyx @@ -7,8 +7,7 @@ #load "core/std" -#import core -use core +use core {*} main :: (args: [] cstr) { // A dummy array to demonstrate. diff --git a/examples/06_dynamic_arrays.onyx b/examples/06_dynamic_arrays.onyx index 2825d4cc..b6e203c2 100644 --- a/examples/06_dynamic_arrays.onyx +++ b/examples/06_dynamic_arrays.onyx @@ -9,8 +9,7 @@ #load "core/std" -#import core -use core +use core {*} main :: (args: [] cstr) { // Declaring dynamic arrays in Onyx looks like this. The diff --git a/examples/07_structs.onyx b/examples/07_structs.onyx index e7bd2e43..1e2347e1 100644 --- a/examples/07_structs.onyx +++ b/examples/07_structs.onyx @@ -7,8 +7,7 @@ #load "core/std" -#import core -use core +use core {*} main :: (args: [] cstr) { diff --git a/examples/08_enums.onyx b/examples/08_enums.onyx index bc145828..041865ce 100644 --- a/examples/08_enums.onyx +++ b/examples/08_enums.onyx @@ -6,8 +6,7 @@ #load "core/std" -#import core -use core +use core {*} main :: (args: [] cstr) { // To declare a simple, use the enum keyword. diff --git a/examples/10_switch_statements.onyx b/examples/10_switch_statements.onyx index cbfce526..ef85b576 100644 --- a/examples/10_switch_statements.onyx +++ b/examples/10_switch_statements.onyx @@ -1,7 +1,6 @@ #load "core/std" -#import core -use core +use core {*} main :: (args: [] cstr) { x := 10 + 3 * 5; diff --git a/examples/11_map.onyx b/examples/11_map.onyx index d3c9c6cc..8bd00846 100644 --- a/examples/11_map.onyx +++ b/examples/11_map.onyx @@ -1,7 +1,6 @@ #load "core/std" -#import core -use core +use core {*} main :: (args: [] cstr) { // Onyx does not have map type built into the language semantics, diff --git a/examples/12_varargs.onyx b/examples/12_varargs.onyx index 649c5fda..26c29a01 100644 --- a/examples/12_varargs.onyx +++ b/examples/12_varargs.onyx @@ -17,8 +17,7 @@ #load "core/std" -#import core -use core +use core {*} main :: (args: [] cstr) { diff --git a/examples/13_use_keyword.onyx b/examples/13_use_keyword.onyx index 7edf73b3..635b4e75 100644 --- a/examples/13_use_keyword.onyx +++ b/examples/13_use_keyword.onyx @@ -16,8 +16,7 @@ #load "core/std" -#import core -use core +use core {*} main :: (args: [] cstr) { // Here are the uses of 'use' currently. @@ -37,7 +36,7 @@ main :: (args: [] cstr) { // is a subpackage of 'core' and the above 'use core' makes this package // available for you to write code like 'string.equal(...)'. However, because it is // a namespace, you can 'use' it. - use string + use core.string s := " Some string ..."; t := strip_leading_whitespace(s); // This would have to be 'string.strip_leading_whitespace' otherwise. diff --git a/examples/14_overloaded_procs.onyx b/examples/14_overloaded_procs.onyx index c555e693..c3645e5a 100644 --- a/examples/14_overloaded_procs.onyx +++ b/examples/14_overloaded_procs.onyx @@ -34,8 +34,7 @@ #load "core/std" -#import core -use core +use core {*} main :: (args: [] cstr) { // See the overloaded procedure defined below. @@ -95,7 +94,7 @@ print_type :: #match { Person :: struct { name: str; age: i32; } // The overload option for hashing a person: -#match (package core).hash.to_u32 (use p: Person) -> u32 { +#match hash.to_u32 (use p: Person) -> u32 { return hash.to_u32(name) * 16239563 + age; } diff --git a/examples/15_polymorphic_procs.onyx b/examples/15_polymorphic_procs.onyx index 6fb1300d..34c6a865 100644 --- a/examples/15_polymorphic_procs.onyx +++ b/examples/15_polymorphic_procs.onyx @@ -59,8 +59,7 @@ compose :: (a: $A, f: (A) -> $B, g: (B) -> $C) -> C { #load "core/std" -#import core -use core +use core {*} main :: (args: [] cstr) { } diff --git a/examples/16_pipe_operator.onyx b/examples/16_pipe_operator.onyx index ba69e6d8..aa1336a0 100644 --- a/examples/16_pipe_operator.onyx +++ b/examples/16_pipe_operator.onyx @@ -1,6 +1,5 @@ #load "core/std" -#import core use core { println } main :: (args: [] cstr) { diff --git a/examples/17_operator_overload.onyx b/examples/17_operator_overload.onyx index 091c66b4..5b86907f 100644 --- a/examples/17_operator_overload.onyx +++ b/examples/17_operator_overload.onyx @@ -1,6 +1,5 @@ #load "core/std" -#import core -use core +use core {*} // Operator overloading allows you to define what it means to perform // a binary operation between two types. In Onyx, they are defined in diff --git a/examples/18_macros.onyx b/examples/18_macros.onyx index e01ae472..1361d6d5 100644 --- a/examples/18_macros.onyx +++ b/examples/18_macros.onyx @@ -135,5 +135,4 @@ main :: (args: [] cstr) { } #load "core/std" -#import core -use core +use core {*} diff --git a/examples/19_do_blocks.onyx b/examples/19_do_blocks.onyx index b4f47106..8c60673b 100644 --- a/examples/19_do_blocks.onyx +++ b/examples/19_do_blocks.onyx @@ -66,5 +66,4 @@ main :: (args: [] cstr) { } #load "core/std" -#import core -use core +use core {*} diff --git a/examples/20_auto_return.onyx b/examples/20_auto_return.onyx index b72800f4..72519dd4 100644 --- a/examples/20_auto_return.onyx +++ b/examples/20_auto_return.onyx @@ -43,6 +43,5 @@ main :: (args: [] cstr) { } #load "core/std" -#import core -use core +use core {*} diff --git a/examples/21_quick_functions.onyx b/examples/21_quick_functions.onyx index bac0dc17..6434ef0d 100644 --- a/examples/21_quick_functions.onyx +++ b/examples/21_quick_functions.onyx @@ -45,5 +45,4 @@ main :: (args) => { } #load "core/std" -#import core -use core +use core {*} diff --git a/examples/22_interfaces.onyx b/examples/22_interfaces.onyx index 5a0da1e8..9b5e5678 100644 --- a/examples/22_interfaces.onyx +++ b/examples/22_interfaces.onyx @@ -135,6 +135,5 @@ main :: (args) => { } #load "core/std" -#import core -use core -use core.intrinsics.onyx +use core {*} +use core.intrinsics.onyx {*} diff --git a/examples/50_misc.onyx b/examples/50_misc.onyx index 193c6bdb..57d6ee40 100644 --- a/examples/50_misc.onyx +++ b/examples/50_misc.onyx @@ -67,5 +67,4 @@ main :: (args) => { } #load "core/std" -#import core -use core +use core {*} diff --git a/tests/aoc-2020/day1.onyx b/tests/aoc-2020/day1.onyx index 1547b17f..370afa65 100644 --- a/tests/aoc-2020/day1.onyx +++ b/tests/aoc-2020/day1.onyx @@ -1,8 +1,8 @@ #load "core/std" -#import core -#import core.io -#import core.array +use core +use core.io +use core.array use core {printf} main :: (args: [] cstr) { diff --git a/tests/aoc-2020/day10.onyx b/tests/aoc-2020/day10.onyx index 001d4fc8..026f6e69 100644 --- a/tests/aoc-2020/day10.onyx +++ b/tests/aoc-2020/day10.onyx @@ -1,6 +1,6 @@ #load "core/std" -#import core {*} +use core {*} count_ending_paths :: (nums: [..] u32) -> u64 { tally := array.make(u64, nums.count); diff --git a/tests/aoc-2020/day12.onyx b/tests/aoc-2020/day12.onyx index e57cbe51..1ba62948 100644 --- a/tests/aoc-2020/day12.onyx +++ b/tests/aoc-2020/day12.onyx @@ -1,6 +1,6 @@ #load "core/std" -#import core {*} +use core {*} Ship :: struct { x : i32 = 0; diff --git a/tests/aoc-2020/day13.onyx b/tests/aoc-2020/day13.onyx index f695a1d1..17fb7d55 100644 --- a/tests/aoc-2020/day13.onyx +++ b/tests/aoc-2020/day13.onyx @@ -1,6 +1,6 @@ #load "core/std" -#import core {*} +use core {*} inv_mod :: (a_: i64, m_: i64) -> i64 { if m_ <= 1 do return 0; diff --git a/tests/aoc-2020/day14.onyx b/tests/aoc-2020/day14.onyx index 37828521..935d5221 100644 --- a/tests/aoc-2020/day14.onyx +++ b/tests/aoc-2020/day14.onyx @@ -1,6 +1,6 @@ #load "core/std" -#import core {*} +use core {*} MASK_SIZE :: 36 Bitmask :: [MASK_SIZE] u8; diff --git a/tests/aoc-2020/day15.onyx b/tests/aoc-2020/day15.onyx index 76795087..875b58f1 100644 --- a/tests/aoc-2020/day15.onyx +++ b/tests/aoc-2020/day15.onyx @@ -1,6 +1,6 @@ #load "core/std" -#import core {*} +use core {*} initial_numbers := u32.[ 1, 20, 8, 12, 0, 14 ]; diff --git a/tests/aoc-2020/day16.onyx b/tests/aoc-2020/day16.onyx index 1e3be230..feba6fbf 100644 --- a/tests/aoc-2020/day16.onyx +++ b/tests/aoc-2020/day16.onyx @@ -1,6 +1,6 @@ #load "core/std" -#import core {*} +use core {*} Field :: struct { name : str = ""; diff --git a/tests/aoc-2020/day18.onyx b/tests/aoc-2020/day18.onyx index 70d9206d..b22f1441 100644 --- a/tests/aoc-2020/day18.onyx +++ b/tests/aoc-2020/day18.onyx @@ -1,6 +1,6 @@ #load "core/std" -#import core {*} +use core {*} parse_factor :: (file: &str) -> u64 { string.strip_leading_whitespace(file); diff --git a/tests/aoc-2020/day19.onyx b/tests/aoc-2020/day19.onyx index 62907f7a..4aace287 100644 --- a/tests/aoc-2020/day19.onyx +++ b/tests/aoc-2020/day19.onyx @@ -1,6 +1,6 @@ #load "core/std" -#import core {*} +use core {*} // nt -> t Term :: struct { diff --git a/tests/aoc-2020/day2.onyx b/tests/aoc-2020/day2.onyx index 6d0f8cfd..9349d7f4 100644 --- a/tests/aoc-2020/day2.onyx +++ b/tests/aoc-2020/day2.onyx @@ -2,7 +2,7 @@ package main #load "core/std" -#import core {*} +use core {*} main :: (args: [] cstr) { contents := #file_contents "./tests/aoc-2020/input/day2.txt"; diff --git a/tests/aoc-2020/day20.onyx b/tests/aoc-2020/day20.onyx index 58f8be71..de23bf83 100644 --- a/tests/aoc-2020/day20.onyx +++ b/tests/aoc-2020/day20.onyx @@ -1,6 +1,6 @@ #load "core/std" -#import core {*} +use core {*} TILE_DATA_WIDTH :: 10 TILE_DATA_HEIGHT :: 10 diff --git a/tests/aoc-2020/day21.onyx b/tests/aoc-2020/day21.onyx index 791bca19..db9471e7 100644 --- a/tests/aoc-2020/day21.onyx +++ b/tests/aoc-2020/day21.onyx @@ -1,6 +1,6 @@ #load "core/std" -#import core {*} +use core {*} /* What questions the data layout needs to answer easily: diff --git a/tests/aoc-2020/day22.onyx b/tests/aoc-2020/day22.onyx index 69a73ee7..8e646495 100644 --- a/tests/aoc-2020/day22.onyx +++ b/tests/aoc-2020/day22.onyx @@ -1,6 +1,6 @@ #load "core/std" -#import core {*} +use core {*} key_arena : alloc.arena.ArenaState; key_alloc : Allocator; diff --git a/tests/aoc-2020/day23.onyx b/tests/aoc-2020/day23.onyx index 24973d9d..521e9ad4 100644 --- a/tests/aoc-2020/day23.onyx +++ b/tests/aoc-2020/day23.onyx @@ -1,6 +1,6 @@ #load "core/std" -#import core {*} +use core {*} cups : [..] i32; diff --git a/tests/aoc-2020/day24.onyx b/tests/aoc-2020/day24.onyx index 2b930623..903e11a4 100644 --- a/tests/aoc-2020/day24.onyx +++ b/tests/aoc-2020/day24.onyx @@ -1,6 +1,6 @@ #load "core/std" -#import core {*} +use core {*} Vec2 :: struct { x: i32 = 0; diff --git a/tests/aoc-2020/day25.onyx b/tests/aoc-2020/day25.onyx index 0f0078e0..2f1dbe2f 100644 --- a/tests/aoc-2020/day25.onyx +++ b/tests/aoc-2020/day25.onyx @@ -1,6 +1,6 @@ #load "core/std" -#import core {*} +use core {*} power_mod :: (base: u32, exp: u32, mod: u32) -> u32 { t: u64 = 1; diff --git a/tests/aoc-2020/day3.onyx b/tests/aoc-2020/day3.onyx index 2b03522c..177ad995 100644 --- a/tests/aoc-2020/day3.onyx +++ b/tests/aoc-2020/day3.onyx @@ -1,6 +1,6 @@ #load "core/std" -#import core {*} +use core {*} Point :: struct { x, y : i32; diff --git a/tests/aoc-2020/day4.onyx b/tests/aoc-2020/day4.onyx index 089934f0..06d1a0f5 100644 --- a/tests/aoc-2020/day4.onyx +++ b/tests/aoc-2020/day4.onyx @@ -1,6 +1,6 @@ #load "core/std" -#import core {*} +use core {*} // Returns the number of fields process_passport :: (contents: &str) -> u32 { diff --git a/tests/aoc-2020/day5.onyx b/tests/aoc-2020/day5.onyx index 7fdb64ec..1a5f1f18 100644 --- a/tests/aoc-2020/day5.onyx +++ b/tests/aoc-2020/day5.onyx @@ -1,6 +1,6 @@ #load "core/std" -#import core {*} +use core {*} main :: (args: [] cstr) { contents := #file_contents "./tests/aoc-2020/input/day5.txt"; diff --git a/tests/aoc-2020/day6.onyx b/tests/aoc-2020/day6.onyx index 5835e20a..45852969 100644 --- a/tests/aoc-2020/day6.onyx +++ b/tests/aoc-2020/day6.onyx @@ -1,6 +1,6 @@ #load "core/std" -#import core {*} +use core {*} part_1 :: (contents: &str) -> u32 { chars : [26] bool; diff --git a/tests/aoc-2020/day7.onyx b/tests/aoc-2020/day7.onyx index eaccf477..1e50115c 100644 --- a/tests/aoc-2020/day7.onyx +++ b/tests/aoc-2020/day7.onyx @@ -1,6 +1,6 @@ #load "core/std" -#import core {*} +use core {*} BagGraph :: struct { nodes : [..] &BagNode; diff --git a/tests/aoc-2020/day8.onyx b/tests/aoc-2020/day8.onyx index 92c5417b..cb0b4ff1 100644 --- a/tests/aoc-2020/day8.onyx +++ b/tests/aoc-2020/day8.onyx @@ -1,6 +1,6 @@ #load "core/std" -#import core {*} +use core {*} OpCode :: enum (u16) { Nop; Acc; Jmp; diff --git a/tests/aoc-2020/day9.onyx b/tests/aoc-2020/day9.onyx index 9e869b6a..efb942de 100644 --- a/tests/aoc-2020/day9.onyx +++ b/tests/aoc-2020/day9.onyx @@ -1,6 +1,6 @@ #load "core/std" -#import core {*} +use core {*} find_contiguous_subarray_with_sum :: (nums: [..] u64, sum: u64) -> (i32, i32) { start := 0; diff --git a/tests/aoc-2021/day01.onyx b/tests/aoc-2021/day01.onyx index e227592d..e306be1a 100644 --- a/tests/aoc-2021/day01.onyx +++ b/tests/aoc-2021/day01.onyx @@ -1,8 +1,8 @@ #load "core/std" -#import core.io -#import core.os -#import core {printf} +use core.io +use core.os +use core {printf} count_increasing :: (arr: [] $T) -> u32 { increased_count := 0; diff --git a/tests/aoc-2021/day02.onyx b/tests/aoc-2021/day02.onyx index 34c353ef..1921e7bf 100644 --- a/tests/aoc-2021/day02.onyx +++ b/tests/aoc-2021/day02.onyx @@ -1,6 +1,6 @@ PART :: 2 -#import core {*} +use core {*} main :: (args) => { for file: os.with_file("tests/aoc-2021/input/day02.txt") { diff --git a/tests/aoc-2021/day03.onyx b/tests/aoc-2021/day03.onyx index fcaa57a8..d9ccdd57 100644 --- a/tests/aoc-2021/day03.onyx +++ b/tests/aoc-2021/day03.onyx @@ -2,7 +2,7 @@ PART :: 2 #load "core/std" -#import core {*} +use core {*} read_binary :: (r: &io.Reader) -> i32 { n := 0; diff --git a/tests/aoc-2021/day04.onyx b/tests/aoc-2021/day04.onyx index 0bf7f8e2..f63e2ab8 100644 --- a/tests/aoc-2021/day04.onyx +++ b/tests/aoc-2021/day04.onyx @@ -1,6 +1,6 @@ #load "core/std" -#import core {*} +use core {*} Cell :: u8 diff --git a/tests/aoc-2021/day05.onyx b/tests/aoc-2021/day05.onyx index eadadbec..f87b0667 100644 --- a/tests/aoc-2021/day05.onyx +++ b/tests/aoc-2021/day05.onyx @@ -1,6 +1,6 @@ #load "core/std" -#import core {*} +use core {*} Line :: struct { x1, y1: i32; diff --git a/tests/aoc-2021/day06.onyx b/tests/aoc-2021/day06.onyx index 8dfe61b9..680caa90 100644 --- a/tests/aoc-2021/day06.onyx +++ b/tests/aoc-2021/day06.onyx @@ -1,6 +1,6 @@ #load "core/std" -#import core {*} +use core {*} main :: (args) => { for file: os.with_file("./tests/aoc-2021/input/day06.txt") { diff --git a/tests/aoc-2021/day07.onyx b/tests/aoc-2021/day07.onyx index 3d7bfada..05a12ec7 100644 --- a/tests/aoc-2021/day07.onyx +++ b/tests/aoc-2021/day07.onyx @@ -1,6 +1,6 @@ #load "core/std" -#import core {*} +use core {*} main :: (args) => { for file: os.with_file("./tests/aoc-2021/input/day07.txt") { diff --git a/tests/aoc-2021/day08.onyx b/tests/aoc-2021/day08.onyx index 9c89487a..2ea49697 100644 --- a/tests/aoc-2021/day08.onyx +++ b/tests/aoc-2021/day08.onyx @@ -1,7 +1,7 @@ PART :: 2 #load "core/std" -#import core {*} +use core {*} // Encoded segments // diff --git a/tests/aoc-2021/day09.onyx b/tests/aoc-2021/day09.onyx index 83e438d1..7a7eeed9 100644 --- a/tests/aoc-2021/day09.onyx +++ b/tests/aoc-2021/day09.onyx @@ -1,6 +1,6 @@ #load "core/std" -#import core {*} +use core {*} Pos :: struct {x,y: i32;} #match hash.to_u32 (use p: Pos) => x * 13 & 17 * y; diff --git a/tests/aoc-2021/day10.onyx b/tests/aoc-2021/day10.onyx index 7a3da0bc..caa399cb 100644 --- a/tests/aoc-2021/day10.onyx +++ b/tests/aoc-2021/day10.onyx @@ -1,6 +1,6 @@ #load "core/std" -#import core {*} +use core {*} main :: (args) => { for file: os.with_file("./tests/aoc-2021/input/day10.txt") { diff --git a/tests/aoc-2021/day11.onyx b/tests/aoc-2021/day11.onyx index 9baff835..81e872ab 100644 --- a/tests/aoc-2021/day11.onyx +++ b/tests/aoc-2021/day11.onyx @@ -1,6 +1,6 @@ #load "core/std" -#import core {*} +use core {*} Pos :: struct {x, y:i32;} #match hash.to_u32 (use p: Pos) => x * 45238271 + y * 34725643; diff --git a/tests/aoc-2021/day12.onyx b/tests/aoc-2021/day12.onyx index 8d42a94b..34a54f0d 100644 --- a/tests/aoc-2021/day12.onyx +++ b/tests/aoc-2021/day12.onyx @@ -1,6 +1,6 @@ #load "core/std" -#import core {*} +use core {*} Communative_Pair :: struct (T: type_expr) where hash.Hashable(T) { a, b: T; diff --git a/tests/aoc-2021/day13.onyx b/tests/aoc-2021/day13.onyx index b1dcf4d9..5d5daa13 100644 --- a/tests/aoc-2021/day13.onyx +++ b/tests/aoc-2021/day13.onyx @@ -1,6 +1,6 @@ #load "core/std" -#import core {*} +use core {*} Point :: struct { x, y: i32; diff --git a/tests/aoc-2021/day14.onyx b/tests/aoc-2021/day14.onyx index 843e95d0..faf3452e 100644 --- a/tests/aoc-2021/day14.onyx +++ b/tests/aoc-2021/day14.onyx @@ -1,6 +1,6 @@ #load "core/std" -#import core {*} +use core {*} Rule :: struct { pair: Pair(u8, u8); diff --git a/tests/aoc-2021/day15.onyx b/tests/aoc-2021/day15.onyx index 9fd783cb..d1b08461 100644 --- a/tests/aoc-2021/day15.onyx +++ b/tests/aoc-2021/day15.onyx @@ -1,6 +1,6 @@ #load "core/std" -#import core {*} +use core {*} queued :: struct { x, y: i32; cost: i32; }; #operator == (u1, u2: queued) => u1.x == u2.x && u1.y == u2.y; diff --git a/tests/aoc-2021/day16.onyx b/tests/aoc-2021/day16.onyx index afbbe24d..886cc86d 100644 --- a/tests/aoc-2021/day16.onyx +++ b/tests/aoc-2021/day16.onyx @@ -1,6 +1,6 @@ #load "core/std" -#import core {*} +use core {*} base16_to_hex :: (s: str) -> u32 { res := 0; diff --git a/tests/aoc-2021/day17.onyx b/tests/aoc-2021/day17.onyx index cd917f69..c0d8cbba 100644 --- a/tests/aoc-2021/day17.onyx +++ b/tests/aoc-2021/day17.onyx @@ -1,6 +1,6 @@ #load "core/std" -#import core {*} +use core {*} tx0: i32 ty0: i32 diff --git a/tests/array_struct_robustness.onyx b/tests/array_struct_robustness.onyx index a7184776..1eb734e5 100644 --- a/tests/array_struct_robustness.onyx +++ b/tests/array_struct_robustness.onyx @@ -1,6 +1,6 @@ #load "core/std" -#import core {*} +use core {*} Vec2 :: struct { x: i32; y: i32; } diff --git a/tests/arrow_notation.onyx b/tests/arrow_notation.onyx index 162e1fa3..9fd69352 100644 --- a/tests/arrow_notation.onyx +++ b/tests/arrow_notation.onyx @@ -1,7 +1,7 @@ #load "core/std" -#import core -#import core.conv +use core +use core.conv use core {println} diff --git a/tests/atomics.onyx b/tests/atomics.onyx index 4eb7fd17..bfc23104 100644 --- a/tests/atomics.onyx +++ b/tests/atomics.onyx @@ -1,8 +1,8 @@ #load "core/std" #load "core/intrinsics/atomics" -#import core {*} -#import core.intrinsics.atomics {*} +use core {*} +use core.intrinsics.atomics {*} Shared_Data :: struct { arr: [] i32; diff --git a/tests/auto_poly.onyx b/tests/auto_poly.onyx index 2a38250e..68315956 100644 --- a/tests/auto_poly.onyx +++ b/tests/auto_poly.onyx @@ -1,6 +1,6 @@ #load "core/std" -#import core {*} +use core {*} dumb :: (it: Iterator, m: &Map) { println(it.Iter_Type); diff --git a/tests/avl_test.onyx b/tests/avl_test.onyx index 6575cde0..de302e77 100644 --- a/tests/avl_test.onyx +++ b/tests/avl_test.onyx @@ -1,6 +1,6 @@ #load "core/std" -#import core {*} +use core {*} main :: () { tree: &avl_tree.AVL_Tree(i32); diff --git a/tests/baked_parameters.onyx b/tests/baked_parameters.onyx index f43a7159..8a21aa2f 100644 --- a/tests/baked_parameters.onyx +++ b/tests/baked_parameters.onyx @@ -1,6 +1,6 @@ #load "core/std" -#import core {*} +use core {*} count_to :: ($N: i32) { for i: 0 .. N do printf("{} ", i); diff --git a/tests/better_field_accesses.onyx b/tests/better_field_accesses.onyx index f46d20f4..6b949e51 100644 --- a/tests/better_field_accesses.onyx +++ b/tests/better_field_accesses.onyx @@ -1,6 +1,6 @@ #load "core/std" -#import core {*} +use core {*} Foo :: struct { x, y: i32; diff --git a/tests/bucket_array.onyx b/tests/bucket_array.onyx index 85ca8601..d19715fb 100644 --- a/tests/bucket_array.onyx +++ b/tests/bucket_array.onyx @@ -1,6 +1,6 @@ #load "core/std" -#import core {*} +use core {*} main :: (args: [] cstr) { ba := bucket_array.make(i32, 4); diff --git a/tests/bugs/anonymous_struct_defaults.onyx b/tests/bugs/anonymous_struct_defaults.onyx index 519d7c95..28adc09e 100644 --- a/tests/bugs/anonymous_struct_defaults.onyx +++ b/tests/bugs/anonymous_struct_defaults.onyx @@ -1,6 +1,6 @@ #load "core/std" -#import core {*} +use core {*} S :: struct { some_array: [..] struct { diff --git a/tests/bugs/defer_block_in_macro.onyx b/tests/bugs/defer_block_in_macro.onyx index 46aac22b..9ebc0c95 100644 --- a/tests/bugs/defer_block_in_macro.onyx +++ b/tests/bugs/defer_block_in_macro.onyx @@ -1,6 +1,6 @@ #load "core/std" -#import core {*} +use core {*} test_macro :: macro () { defer { diff --git a/tests/bugs/fallthrough_defer_interaction.onyx b/tests/bugs/fallthrough_defer_interaction.onyx index 2d2a001f..1e470ae7 100644 --- a/tests/bugs/fallthrough_defer_interaction.onyx +++ b/tests/bugs/fallthrough_defer_interaction.onyx @@ -1,6 +1,6 @@ #load "core/std" -#import core {*} +use core {*} custom_iterator :: () -> Iterator(i32) { diff --git a/tests/bugs/macro_auto_return_not_resolved.onyx b/tests/bugs/macro_auto_return_not_resolved.onyx index 38f1865b..d4820a78 100644 --- a/tests/bugs/macro_auto_return_not_resolved.onyx +++ b/tests/bugs/macro_auto_return_not_resolved.onyx @@ -1,6 +1,6 @@ #load "core/std" -#import core {*} +use core {*} Point :: struct { x, y: i32; } diff --git a/tests/bugs/namespace_aliasing.onyx b/tests/bugs/namespace_aliasing.onyx index 1261bd98..f3736246 100644 --- a/tests/bugs/namespace_aliasing.onyx +++ b/tests/bugs/namespace_aliasing.onyx @@ -1,5 +1,5 @@ #load "core/std" -#import core {*} +use core {*} SomeNamespace :: struct { foo :: () { diff --git a/tests/bugs/print_formatters.onyx b/tests/bugs/print_formatters.onyx index b30370ae..8df8e017 100644 --- a/tests/bugs/print_formatters.onyx +++ b/tests/bugs/print_formatters.onyx @@ -1,4 +1,4 @@ -#import core +use core use core {printf} main :: () { diff --git a/tests/caller_location.onyx b/tests/caller_location.onyx index 91615d44..f53026af 100644 --- a/tests/caller_location.onyx +++ b/tests/caller_location.onyx @@ -1,6 +1,6 @@ #load "core/std" -#import core {*} +use core {*} using_callsite :: (value: $T, site := #callsite) { println(value); @@ -25,4 +25,4 @@ Something :: struct { } } -#import runtime +use runtime diff --git a/tests/compile_time_procedures.onyx b/tests/compile_time_procedures.onyx index 88d3f130..af5d251c 100644 --- a/tests/compile_time_procedures.onyx +++ b/tests/compile_time_procedures.onyx @@ -1,6 +1,6 @@ #load "core/std" -#import core {*} +use core {*} Test_VTable :: struct { first : (i32) -> i32; diff --git a/tests/complicated_polymorph.onyx b/tests/complicated_polymorph.onyx index e28c1ad7..a66b3091 100644 --- a/tests/complicated_polymorph.onyx +++ b/tests/complicated_polymorph.onyx @@ -1,6 +1,6 @@ #load "core/std" -#import core {*} +use core {*} main :: (args: [] cstr) { baked_proc :: (x: $T, $func: (T) -> typeof x) -> T { diff --git a/tests/defer_with_continue.onyx b/tests/defer_with_continue.onyx index bbf58fff..d3758e6a 100644 --- a/tests/defer_with_continue.onyx +++ b/tests/defer_with_continue.onyx @@ -1,6 +1,6 @@ #load "core/std" -#import core {*} +use core {*} main :: (args: [] cstr) { defer println("At the end!"); diff --git a/tests/defined_test.onyx b/tests/defined_test.onyx index fffb5852..bc4b6843 100644 --- a/tests/defined_test.onyx +++ b/tests/defined_test.onyx @@ -1,6 +1,6 @@ #load "core/std" -#import core {*} +use core {*} main :: (args: [] cstr) { println(#defined(stdio)); diff --git a/tests/dyn_str.onyx b/tests/dyn_str.onyx index 668a829f..c35fbb94 100644 --- a/tests/dyn_str.onyx +++ b/tests/dyn_str.onyx @@ -1,6 +1,6 @@ -#import core.string -#import core.conv -#import core +use core.string +use core.conv +use core use core { println diff --git a/tests/first_class_optional.onyx b/tests/first_class_optional.onyx index f86c33c9..7b1723b1 100644 --- a/tests/first_class_optional.onyx +++ b/tests/first_class_optional.onyx @@ -1,4 +1,4 @@ -#import core +use core use core {println} foo :: (x: ?i32) -> i32 { diff --git a/tests/float_parsing.onyx b/tests/float_parsing.onyx index 4e3ac070..d8e4c653 100644 --- a/tests/float_parsing.onyx +++ b/tests/float_parsing.onyx @@ -1,6 +1,6 @@ #load "core/std" -#import core {*} +use core {*} main :: (args: [] cstr) { diff --git a/tests/i32map.onyx b/tests/i32map.onyx index a8e06d5f..bc452fbe 100644 --- a/tests/i32map.onyx +++ b/tests/i32map.onyx @@ -2,7 +2,7 @@ package main #load "core/std" -#import core {*} +use core {*} main :: (args: [] cstr) { imap : Map(i32, str); diff --git a/tests/implicit_initialize_locals.onyx b/tests/implicit_initialize_locals.onyx index 4c099ce2..b888294d 100644 --- a/tests/implicit_initialize_locals.onyx +++ b/tests/implicit_initialize_locals.onyx @@ -1,6 +1,6 @@ #load "core/std" -#import core {*} +use core {*} main :: (args) => { { diff --git a/tests/init_procedures.onyx b/tests/init_procedures.onyx index b5ba5a32..c45559f5 100644 --- a/tests/init_procedures.onyx +++ b/tests/init_procedures.onyx @@ -1,6 +1,6 @@ #load "core/std" -#import core {*} +use core {*} first_init :: #init #after second_init () { println("In an #init proc."); diff --git a/tests/interfaces.onyx b/tests/interfaces.onyx index 5134c42b..4c4e0420 100644 --- a/tests/interfaces.onyx +++ b/tests/interfaces.onyx @@ -1,10 +1,10 @@ #load "core/std" -#import core -#import core.hash -#import core.conv -#import core.array -#import core.iter +use core +use core.hash +use core.conv +use core.array +use core.iter use core {println, printf} diff --git a/tests/lazy_iterators.onyx b/tests/lazy_iterators.onyx index 604cfaba..3b7d4c5d 100644 --- a/tests/lazy_iterators.onyx +++ b/tests/lazy_iterators.onyx @@ -1,6 +1,6 @@ #load "core/std" -#import core {*} +use core {*} count_iterator :: (lo: $T, hi: T, step: T = 1) -> Iterator(T) { return iter.generator( diff --git a/tests/linked_lists.onyx b/tests/linked_lists.onyx index 7d075552..643269c5 100644 --- a/tests/linked_lists.onyx +++ b/tests/linked_lists.onyx @@ -1,5 +1,5 @@ -#import core -#import core.list +use core +use core.list use core {println} diff --git a/tests/named_arguments_test.onyx b/tests/named_arguments_test.onyx index 26bd8e05..0b3b6922 100644 --- a/tests/named_arguments_test.onyx +++ b/tests/named_arguments_test.onyx @@ -1,6 +1,6 @@ #load "core/std" -#import core {*} +use core {*} main :: (args: [] cstr) { foo :: (x: i32, y: f32) { diff --git a/tests/new_printf.onyx b/tests/new_printf.onyx index 2887e871..60cd3c67 100644 --- a/tests/new_printf.onyx +++ b/tests/new_printf.onyx @@ -1,6 +1,6 @@ #load "core/std" -#import core {printf, map} +use core {printf, map} main :: (args: [] cstr) { printf("{} {} {{}} {} {.1} {.5} {}\n", 123, "Test", false, 12.34, 12.3456789, [..] map.Map(i32, str)); diff --git a/tests/new_struct_behaviour.onyx b/tests/new_struct_behaviour.onyx index a9eef06a..8063a110 100644 --- a/tests/new_struct_behaviour.onyx +++ b/tests/new_struct_behaviour.onyx @@ -2,7 +2,7 @@ #load "core/std" -#import core {*} +use core {*} Vec3 :: struct { diff --git a/tests/operator_overload.onyx b/tests/operator_overload.onyx index 72df5149..40e726c1 100644 --- a/tests/operator_overload.onyx +++ b/tests/operator_overload.onyx @@ -1,6 +1,6 @@ #load "core/std" -#import core {*} +use core {*} Complex :: struct { re : f32 = 0; diff --git a/tests/osad_test.onyx b/tests/osad_test.onyx index ff1072eb..faba2918 100644 --- a/tests/osad_test.onyx +++ b/tests/osad_test.onyx @@ -1,5 +1,5 @@ -#import core -#import core.encoding.osad +use core +use core.encoding.osad use core {printf} diff --git a/tests/overload_precedence.onyx b/tests/overload_precedence.onyx index 54752d70..37c04132 100644 --- a/tests/overload_precedence.onyx +++ b/tests/overload_precedence.onyx @@ -1,6 +1,6 @@ #load "core/std" -#import core {*} +use core {*} overloaded :: #match { #order 10 (x: i32) { println("Option X"); }, diff --git a/tests/overload_return_type.onyx b/tests/overload_return_type.onyx index 868462c1..14a522bc 100644 --- a/tests/overload_return_type.onyx +++ b/tests/overload_return_type.onyx @@ -1,5 +1,5 @@ -#import core +use core use core { println } main :: () { diff --git a/tests/overload_with_autocast.onyx b/tests/overload_with_autocast.onyx index 93ee4ee6..fdd15b0e 100644 --- a/tests/overload_with_autocast.onyx +++ b/tests/overload_with_autocast.onyx @@ -1,6 +1,6 @@ #load "core/std" -#import core +use core use core {println} overloaded :: #match { diff --git a/tests/persist_locals.onyx b/tests/persist_locals.onyx index 7902615d..27b134d2 100644 --- a/tests/persist_locals.onyx +++ b/tests/persist_locals.onyx @@ -2,7 +2,7 @@ #load "core/std" -#import core {*} +use core {*} main :: (args: [] cstr) { diff --git a/tests/poly_struct_in_type_info.onyx b/tests/poly_struct_in_type_info.onyx index bd58c0c8..8ee9da74 100644 --- a/tests/poly_struct_in_type_info.onyx +++ b/tests/poly_struct_in_type_info.onyx @@ -1,7 +1,7 @@ #load "core/std" -#import core {*} -#import runtime.info +use core {*} +use runtime.info Base :: struct (T: type_expr) { const: i32; diff --git a/tests/poly_structs_with_values.onyx b/tests/poly_structs_with_values.onyx index f865277a..df466d14 100644 --- a/tests/poly_structs_with_values.onyx +++ b/tests/poly_structs_with_values.onyx @@ -1,6 +1,6 @@ #load "core/std" -#import core {*} +use core {*} main :: (args: [] cstr) { NewPolyStruct :: struct (T: type_expr, N: i32) { diff --git a/tests/polymorphic_array_lengths.onyx b/tests/polymorphic_array_lengths.onyx index 526102b1..e44edcde 100644 --- a/tests/polymorphic_array_lengths.onyx +++ b/tests/polymorphic_array_lengths.onyx @@ -1,6 +1,6 @@ #load "core/std" -#import core {*} +use core {*} main :: (args: [] cstr) { arr := u32.[ 1, 2, 3, 4, 5 ]; diff --git a/tests/remove_test.onyx b/tests/remove_test.onyx index 398e37a0..24e7a6bc 100644 --- a/tests/remove_test.onyx +++ b/tests/remove_test.onyx @@ -1,6 +1,6 @@ #load "core/std" -#import core {*} +use core {*} main :: (args) => { x: [..] i32; diff --git a/tests/sets.onyx b/tests/sets.onyx index 4d435566..a1cf8b9b 100644 --- a/tests/sets.onyx +++ b/tests/sets.onyx @@ -1,6 +1,6 @@ #load "core/std" -#import core {*} +use core {*} main :: (args: [] cstr) { diff --git a/tests/stdlib/base64.onyx b/tests/stdlib/base64.onyx index faf2330a..9af3134d 100644 --- a/tests/stdlib/base64.onyx +++ b/tests/stdlib/base64.onyx @@ -1,5 +1,5 @@ -#import core -#import core.encoding.base64 +use core +use core.encoding.base64 decode_test :: () { for .[ diff --git a/tests/string_stream_test.onyx b/tests/string_stream_test.onyx index 1eabe635..516c112e 100644 --- a/tests/string_stream_test.onyx +++ b/tests/string_stream_test.onyx @@ -1,7 +1,7 @@ #load "core/std" -#import core -#import core.io +use core +use core.io use core {println} main :: (args: [] cstr) { diff --git a/tests/struct_robustness.onyx b/tests/struct_robustness.onyx index 0ca71560..a35e9396 100644 --- a/tests/struct_robustness.onyx +++ b/tests/struct_robustness.onyx @@ -1,6 +1,6 @@ #load "core/std" -#import core {*} +use core {*} main :: (args: [] cstr) { diff --git a/tests/struct_use_pointer_member.onyx b/tests/struct_use_pointer_member.onyx index 51925dd1..84a8ed26 100644 --- a/tests/struct_use_pointer_member.onyx +++ b/tests/struct_use_pointer_member.onyx @@ -1,5 +1,5 @@ #load "core/std" -#import core {*} +use core {*} Person_Vtable :: struct { greet: (&Person) -> void; diff --git a/tests/switch_using_equals.onyx b/tests/switch_using_equals.onyx index 6443aa05..9ed4e1a0 100644 --- a/tests/switch_using_equals.onyx +++ b/tests/switch_using_equals.onyx @@ -1,6 +1,6 @@ #load "core/std" -#import core {*} +use core {*} Vector2 :: struct { x, y: i32; } #operator == macro (v1: Vector2, v2: Vector2) => v1.x == v2.x && v1.y == v2.y; diff --git a/tests/utf8_test.onyx b/tests/utf8_test.onyx index aa80aa04..760b4e60 100644 --- a/tests/utf8_test.onyx +++ b/tests/utf8_test.onyx @@ -1,6 +1,6 @@ -#import core -#import core.encoding.utf8 -#import runtime +use core +use core.encoding.utf8 +use runtime use core {print, println, printf} diff --git a/tests/vararg_test.onyx b/tests/vararg_test.onyx index c6ceac85..f9994ac4 100644 --- a/tests/vararg_test.onyx +++ b/tests/vararg_test.onyx @@ -2,7 +2,7 @@ package main #load "core/std" -#import core {*}; +use core {*}; old_va_test :: (prefix: str, va: ..i32) { println(prefix);