Skip to content

Commit

Permalink
Pin to zig version 0.13.0.
Browse files Browse the repository at this point in the history
  • Loading branch information
wmedrano committed Sep 11, 2024
1 parent 6a7b59b commit c816701
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 15 deletions.
14 changes: 7 additions & 7 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ jobs:
steps:
- uses: actions/checkout@v2
- uses: goto-bus-stop/setup-zig@v2
- run: zig build test
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: goto-bus-stop/setup-zig@v2
- run: zig fmt --check .
with:
zig-version: 0.13.0
- name: test
run: zig build test
- name: lint
run: zig fmt --check .
if: always()
2 changes: 0 additions & 2 deletions src/Vm.zig
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,6 @@ pub fn evalNoReset(self: *Vm, func: Val, args: []const Val) Error!Val {
self.env.stack.items = self.env.stack.items[0..stack_start];
return ret;
} else {
@setCold(true);
return .none;
}
},
Expand Down Expand Up @@ -406,7 +405,6 @@ fn executeDefine(self: *Vm, symbol: Symbol) Error!void {
}

fn errSymbolNotFound(self: *Vm, sym: Symbol) Error {
@setCold(true);
const name = self.env.memory_manager.symbols.getName(sym) orelse "*unknown-symbol*";
try self.env.errors.addError(
"Symbol {s} (id={d}) not found in global values",
Expand Down
6 changes: 0 additions & 6 deletions src/datastructures/ErrorCollector.zig
Original file line number Diff line number Diff line change
Expand Up @@ -4,39 +4,33 @@ const std = @import("std");
errors: std.ArrayList([]const u8),

pub fn init(alloc: std.mem.Allocator) ErrorCollector {
@setCold(true);
return .{
.errors = std.ArrayList([]const u8).init(alloc),
};
}

pub fn deinit(self: *ErrorCollector) void {
@setCold(true);
self.clear();
self.errors.deinit();
}

pub fn allocator(self: *ErrorCollector) std.mem.Allocator {
@setCold(true);
return self.errors.allocator;
}

pub fn clear(self: *ErrorCollector) void {
@setCold(true);
for (self.errors.items) |msg| {
self.errors.allocator.free(msg);
}
self.errors.clearRetainingCapacity();
}

pub fn addError(self: *ErrorCollector, comptime fmt: []const u8, args: anytype) !void {
@setCold(true);
const msg = try std.fmt.allocPrint(self.allocator(), fmt, args);
try self.errors.append(msg);
}

pub fn format(self: *const ErrorCollector, comptime _: []const u8, _: std.fmt.FormatOptions, writer: anytype) !void {
@setCold(true);
for (self.errors.items) |err| {
try writer.print("{s}\n", .{err});
}
Expand Down

0 comments on commit c816701

Please sign in to comment.