From: Brendan Hansen Date: Tue, 16 Feb 2021 19:47:07 +0000 (-0600) Subject: small cleanup and better CLI documentation X-Git-Url: https://git.brendanfh.com/?a=commitdiff_plain;h=c02192e2060f9caab2fcb9b5ca2d6ec6feaad54c;p=onyx.git small cleanup and better CLI documentation --- diff --git a/bin/onyx b/bin/onyx index 4dff50bc..5e1cdfbd 100755 Binary files a/bin/onyx and b/bin/onyx differ diff --git a/src/onyx.c b/src/onyx.c index 8b26168f..c0969323 100644 --- a/src/onyx.c +++ b/src/onyx.c @@ -38,8 +38,17 @@ static const char* docstring = "Onyx compiler version " VERSION "\n" "Flags:\n" "\t List of initial files\n" "\t-o Specify the target file (default: out.wasm)\n" - "\t-r Specifies a runtime. Can be: wasi, js, custom.\n" - "\t--verbose Verbose output\n"; + "\t--runtime, -r Specifies a runtime. Can be: wasi, js, custom.\n" + "\t--verbose, -V Verbose output\n" + "\t -VV Very verbose output\n" + "\t -VVV Very very verbose output (to be used by compiler developers)\n" + "\t--use-post-mvp-features Enables post MVP WASM features such as memory.copy and memory.fill\n" + "\n" + "Developer flags:\n" + "\t--print-function-mappings Prints a mapping from WASM function index to source location.\n" + "\t--print-static-if-results Prints the conditional result of each #if statement. Useful for debugging.\n" + "\n"; + static CompileOptions compile_opts_parse(bh_allocator alloc, int argc, char *argv[]) { CompileOptions options = { @@ -98,7 +107,7 @@ static CompileOptions compile_opts_parse(bh_allocator alloc, int argc, char *arg else if (!strcmp(argv[i], "-I")) { bh_arr_push(options.included_folders, argv[++i]); } - else if (!strcmp(argv[i], "-r")) { + else if (!strcmp(argv[i], "-r") || !strcmp(argv[i], "--runtime")) { i += 1; if (!strcmp(argv[i], "wasi")) options.runtime = Runtime_Wasi; else if (!strcmp(argv[i], "js")) options.runtime = Runtime_Js; diff --git a/src/onyxsymres.c b/src/onyxsymres.c index 8c707304..5fc8e609 100644 --- a/src/onyxsymres.c +++ b/src/onyxsymres.c @@ -580,6 +580,12 @@ static SymresStatus symres_switch(AstSwitch* switchnode) { 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); + return Symres_Success; + } + if (use->expr->kind == Ast_Kind_Enum_Type) { AstEnumType* et = (AstEnumType *) use->expr; diff --git a/src/onyxwasm.c b/src/onyxwasm.c index d62d44e7..a9742e80 100644 --- a/src/onyxwasm.c +++ b/src/onyxwasm.c @@ -955,7 +955,7 @@ EMIT_FUNC(switch, AstSwitch* switch_node) { WID(WI_I32_CONST, switch_node->min_case); WI(WI_I32_SUB); } - WIL(WI_JUMP_TABLE, (u64) bt); + WIP(WI_JUMP_TABLE, bt); WI(WI_BLOCK_END); bh_arr_each(AstSwitchCase, sc, switch_node->cases) {