Skip to content

Commit e43ff14

Browse files
committed
misc cleanup
1 parent d889ac3 commit e43ff14

6 files changed

Lines changed: 10 additions & 11 deletions

File tree

build.zig

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ pub fn build(b: *std.Build) !void {
4242
const wasm_stack_size =
4343
b.option(u64, "wasm-stack-size", "The size of WASM stack") orelse std.wasm.page_size;
4444
const dynamic = b.option(bool, "dynamic", "Build a dynamic library") orelse false;
45-
const strip = b.option(bool, "strip", "Strip debugging symbols from binary") orelse null;
46-
const pic = b.option(bool, "pic", "Force position independent code") orelse null;
45+
const strip = b.option(bool, "strip", "Strip debugging symbols from binary");
46+
const pic = b.option(bool, "pic", "Force position independent code");
4747
const emit_asm = b.option(bool, "emit-asm", "Output .s (assembly code)") orelse false;
4848
const emit_ll = b.option(bool, "emit-ll", "Output .ll (LLVM IR)") orelse false;
4949

src/lib/bindings/c.zig

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ pub const MAX_LOGS = pkmn.MAX_LOGS;
2323
pub const LOGS_SIZE = pkmn.LOGS_SIZE;
2424

2525
pub fn choice_init(choice: u8, data: u8) callconv(.c) u8 {
26-
assert(choice <= @field(@typeInfo(pkmn.Choice.Type), @tagName(.@"enum")).fields.len);
26+
assert(choice <= @typeInfo(pkmn.Choice.Type).@"enum".fields.len);
2727
assert(data <= 6);
2828
return @bitCast(pkmn.Choice{ .type = @enumFromInt(choice), .data = @intCast(data) });
2929
}
@@ -190,8 +190,8 @@ pub fn gen(comptime num: comptime_int) type {
190190
out: [*]u8,
191191
n: usize,
192192
) callconv(.c) u8 {
193-
assert(player <= @field(@typeInfo(pkmn.Player), @tagName(.@"enum")).fields.len);
194-
assert(request <= @field(@typeInfo(pkmn.Choice.Type), @tagName(.@"enum")).fields.len);
193+
assert(player <= @typeInfo(pkmn.Player).@"enum".fields.len);
194+
assert(request <= @typeInfo(pkmn.Choice.Type).@"enum".fields.len);
195195

196196
assert(!pkmn.options.showdown or n > 0);
197197
return battle.choices(@enumFromInt(player), @enumFromInt(request), @ptrCast(out[0..n]));

src/lib/bindings/wasm.zig

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ pub fn gen(comptime num: comptime_int) type {
3636
request: u8,
3737
buf: [*]u8,
3838
) callconv(.c) u8 {
39-
assert(player <= @field(@typeInfo(pkmn.Player), @tagName(.@"enum")).fields.len);
40-
assert(request <= @field(@typeInfo(pkmn.Choice.Type), @tagName(.@"enum")).fields.len);
39+
assert(player <= @typeInfo(pkmn.Player).@"enum".fields.len);
40+
assert(request <= @typeInfo(pkmn.Choice.Type).@"enum".fields.len);
4141

4242
const n = CHOICES_SIZE;
4343
return battle.choices(@enumFromInt(player), @enumFromInt(request), @ptrCast(buf[0..n]));

src/lib/common/util.zig

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ const expect = std.testing.expect;
44
const expectEqual = std.testing.expectEqual;
55

66
pub fn PointerType(comptime P: type, comptime C: type) type {
7-
return if (@field(@typeInfo(P), @tagName(.pointer)).is_const) *const C else *C;
7+
return if (@typeInfo(P).pointer.is_const) *const C else *C;
88
}
99

1010
test PointerType {
@@ -15,7 +15,7 @@ test PointerType {
1515
pub fn isPointerTo(p: anytype, comptime P: type) bool {
1616
const info = @typeInfo(@TypeOf(p));
1717
return switch (info) {
18-
.pointer => @field(info, @tagName(.pointer)).child == P,
18+
.pointer => info.pointer.child == P,
1919
else => false,
2020
};
2121
}

src/lib/gen1/test.zig

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6864,7 +6864,6 @@ test "Hyper Beam + Substitute bug" {
68646864
try t.verify();
68656865
}
68666866

6867-
// .{ HIT, 1 } ++ @as([30]U, @splat(.{ ~CRIT, HIT }),
68686867
test "Mimic infinite PP bug" {
68696868
// Mimic first
68706869
{

src/tools/release.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ const TARGETS = [
4747
let version: string = sh('zig', ['version'], {bypass: true}).trim();
4848
if (!version.endsWith('.patched')) {
4949
// TODO: ziglang/zig#17768
50-
console.error('Releases must be build with a patched compiler for performance.');
50+
console.error('Releases must be built with a patched compiler for performance.');
5151
process.exit(1);
5252
}
5353

0 commit comments

Comments
 (0)