From 6a36a7d112bef93e6ceba5477a5427e96eed6175 Mon Sep 17 00:00:00 2001 From: chloe caruso Date: Tue, 19 Nov 2024 02:26:01 -0800 Subject: [PATCH] zig upgrade --- build.zig.zon | 4 ++-- src/core/Ast.zig | 2 +- src/core/Sema.zig | 4 ++-- src/core/Transform.zig | 2 +- src/core/mod.zig | 2 +- src/core/stack.zig | 2 ++ src/deps/quickjs/build.zig | 6 +++--- src/main.zig | 2 +- 8 files changed, 13 insertions(+), 11 deletions(-) diff --git a/build.zig.zon b/build.zig.zon index aa369c31acbf845428cae143b9e24886e0ab9ac9..607c0deee2ecdce477aefb5032e25c663cf51964 100644 --- a/build.zig.zon +++ b/build.zig.zon @@ -2,12 +2,12 @@ .name = "", .version = "0.0.0", - .minimum_zig_version = "0.14.0-dev.2034+56996a280", + .minimum_zig_version = "0.14.0-dev.2254+73f2671c7", .dependencies = .{ // Used to determine unicode properties to tokenize identifiers .zg = .{ - .url = "https://codeberg.org/dude_the_builder/zg/archive/c425c9c8511bf92e14b8b612d1d16e774b186f2e.tar.gz", + .url = "https://codeberg.org/atman/zg/archive/c425c9c8511bf92e14b8b612d1d16e774b186f2e.tar.gz", .hash = "1220c79009f1e443b015db4de6e5319432538ead2fea10d271f3f35d3ae83c996789", }, // Optional: Used for tracing diff --git a/src/core/Ast.zig b/src/core/Ast.zig index 2e928d5f5d9c3f01454590c04cae7e37bdad51ad..2d575f03b8e5123b61b5a41aa116a20bc7db4431 100644 --- a/src/core/Ast.zig +++ b/src/core/Ast.zig @@ -360,7 +360,7 @@ pub const Node = struct { }); pub const Data = union { - none: struct { Unused = .zero, Unused = .zero }, + none: struct { a: Unused = .zero, b: Unused = .zero }, function: struct { /// A `Fn` extra: ExtraIndex, diff --git a/src/core/Sema.zig b/src/core/Sema.zig index e28f9493f9bf793f08e2b5977d7c6d1030bb2c4a..a7f7c7d3fcc4cfb36ca33663c6bcf68a2e6bbc88 100644 --- a/src/core/Sema.zig +++ b/src/core/Sema.zig @@ -172,7 +172,7 @@ const Frame = struct { data: Data, const Data = union { - pub const none = .{ .undefined = {} }; + pub const none: Data = .{ .undefined = {} }; undefined: void, conditional: Conditional, @@ -961,7 +961,7 @@ fn stepInner(s: *Sema, comptime tag: Hir.Tag) Error!InstructionKind.fromTag(tag) const data: Hir.Func = s.frame.currentPayload(.func); const reserve = try s.scratch.reserveMulti( s.arena(), - .{ .params = Type, .captures = Air.Inst.Ref }, + FunctionReserve.input, .{ data.params.len, data.captures.len }, ); if (data.captures.len > 0) @panic("TODO: captures"); diff --git a/src/core/Transform.zig b/src/core/Transform.zig index ea0dc52d7b42ec0a9ae441248e214c6d4ea5ca33..22a600a1aee2a9bac9352a5d2fe98e7e5f565fab 100644 --- a/src/core/Transform.zig +++ b/src/core/Transform.zig @@ -368,7 +368,7 @@ const BuiltIn = struct { value: Inst.Ref, }; -const built_in_ids = std.StaticStringMap(BuiltIn).initComptime(.{ +const built_in_ids = std.StaticStringMap(BuiltIn).initComptime([_]struct { []const u8, BuiltIn }{ .{ "void", .{ .value = .void, .type = .void } }, .{ "true", .{ .value = .bool_true, .type = .bool_type } }, .{ "false", .{ .value = .bool_false, .type = .bool_type } }, diff --git a/src/core/mod.zig b/src/core/mod.zig index 2967e13ca05552f5d8f70f80d8741cde89ae548f..61040f4a5f1c97d05f1322e36bffa42e37e600aa 100644 --- a/src/core/mod.zig +++ b/src/core/mod.zig @@ -25,7 +25,7 @@ pub const unicode_props = @import("unicode_props.zig"); // sort-lines: end // The rest of this file is small utility functions, which are not specific to -// any of the above namespaces. Remember Zig discourages namespaces like `utils`. +// any of the above namespaces. Remember, Zig discourages namespaces like `utils`. pub const runtime_safety = switch (@import("builtin").mode) { .Debug, .ReleaseSafe => true, diff --git a/src/core/stack.zig b/src/core/stack.zig index 3e8b00dc1d26c7e2f93a1fe985abf20eee83f88b..b767bb301f051faa071d0121950c59c13c2c3f27 100644 --- a/src/core/stack.zig +++ b/src/core/stack.zig @@ -104,6 +104,8 @@ pub fn Stack(comptime Base: type) type { starts: [fields.len]u32, lengths: [fields.len]u32, + pub const input = types; + fn Type(comptime field: FieldEnum) type { return @field(types, @tagName(field)); } diff --git a/src/deps/quickjs/build.zig b/src/deps/quickjs/build.zig index 243c4620453ffd31663d9a4b3837c5270063eb63..f4e1087604772f16617a68ff4e1ba8ade4189cf6 100644 --- a/src/deps/quickjs/build.zig +++ b/src/deps/quickjs/build.zig @@ -146,10 +146,10 @@ pub fn build(b: *Build) !void { .optimize = optimize, .link_libc = true, }); - const module2 = translate_libc.addModule("quickjs-libc"); + const module_libc = translate_libc.addModule("quickjs-libc"); if (pthread.pthreads) |pt| translate_libc.addIncludePath(pt.include); - module2.linkLibrary(libquickjs); - module2.linkLibrary(libquickjs_libc); + module_libc.linkLibrary(libquickjs); + module_libc.linkLibrary(libquickjs_libc); } fn runQjsc(b: *Build, qjsc: *Build.Step.Compile, in: Build.LazyPath) Build.LazyPath { diff --git a/src/main.zig b/src/main.zig index 5a9f96bbfec1d47ce811ad1172159b375c3411e4..93c23456db46ba37e3dd0cdf03e71bfd734583ed 100644 --- a/src/main.zig +++ b/src/main.zig @@ -41,7 +41,7 @@ const top_level_commands: []const Command.ListItem = &.{ .name = "run", .description = "Create executable and run with QuickJS", .cli = .{ - .options = general_compiler_options ++ .{ + .options = general_compiler_options ++ [_]Cli.Option{ .{ .name = "--dump-code", .desc = "Dump compiled JavaScript to standard out" }, }, .positionals = .single, -- 2.54.0