diff --git a/src/analysis.zig b/src/analysis.zig index bc35d32..078d116 100644 --- a/src/analysis.zig +++ b/src/analysis.zig @@ -25,7 +25,7 @@ pub const Analyzer = struct { }; } - fn setErrContext(self: *@This(), comptime fmt: ?[]const u8, args: var) void { + fn setErrContext(self: *@This(), comptime fmt: ?[]const u8, args: anytype) void { if (fmt == null) { self.err_ctx = null; return; @@ -42,7 +42,7 @@ pub const Analyzer = struct { self.err_tok = tok; } - fn doError(self: *@This(), comptime fmt: []const u8, args: var) void { + fn doError(self: *@This(), comptime fmt: []const u8, args: anytype) void { self.hadError = true; std.debug.warn("analysis error", .{}); diff --git a/src/ast_printer.zig b/src/ast_printer.zig index 328f880..1f248ee 100644 --- a/src/ast_printer.zig +++ b/src/ast_printer.zig @@ -14,12 +14,12 @@ fn printIdent(ident: usize) void { } } -fn print(ident: usize, comptime fmt: []const u8, args: var) void { +fn print(ident: usize, comptime fmt: []const u8, args: anytype) void { printIdent(ident); std.debug.warn(fmt, args); } -fn printBlock(ident: usize, block: var, endNewline: bool) void { +fn printBlock(ident: usize, block: anytype, endNewline: bool) void { std.debug.warn("(\n", .{}); for (block.toSlice()) |stmt| { @@ -156,7 +156,7 @@ fn binOpToStr(op: BinaryOperator) ?[]const u8 { return null; } -fn printBinOp(inner: var) void { +fn printBinOp(inner: anytype) void { std.debug.warn("({}", .{binOpToStr(inner.op)}); printTwoExprs(inner.left, inner.right); std.debug.warn(")", .{}); diff --git a/src/codegen/llvm.zig b/src/codegen/llvm.zig index ff2d6f6..ccde966 100644 --- a/src/codegen/llvm.zig +++ b/src/codegen/llvm.zig @@ -64,7 +64,7 @@ pub const Codegen = struct { }; } - fn emitForVariableType(self: *@This(), vari: var, get: var, kv: var) !llvm.LLVMValueRef { + fn emitForVariableType(self: *@This(), vari: anytype, get: anytype, kv: anytype) !llvm.LLVMValueRef { var sym = kv.value; switch (sym.*) { @@ -89,7 +89,7 @@ pub const Codegen = struct { fn emitExpr( self: *Codegen, - builder: var, + builder: anytype, expr: *const ast.Expr, ) anyerror!llvm.LLVMValueRef { return switch (expr.*) { @@ -260,7 +260,7 @@ pub const Codegen = struct { }; } - fn emitStmt(self: *Codegen, builder: var, stmt: *ast.Stmt) anyerror!void { + fn emitStmt(self: *Codegen, builder: anytype, stmt: *ast.Stmt) anyerror!void { std.debug.warn("cgen: emitting stmt {}\n", .{@as(ast.StmtType, stmt.*)}); switch (stmt.*) { diff --git a/src/errors.zig b/src/errors.zig index 88c05f1..5eb089e 100644 --- a/src/errors.zig +++ b/src/errors.zig @@ -12,7 +12,7 @@ pub fn reportN(line: usize, message: []const u8) void { report(line, "", message); } -pub fn reportFmt(line: usize, ctx_opt: ?[]const u8, comptime fmt: []const u8, args: var) void { +pub fn reportFmt(line: usize, ctx_opt: ?[]const u8, comptime fmt: []const u8, args: anytype) void { if (ctx_opt) |ctx| { std.debug.warn("[line {}] Error on {}", .{ line, ctx }); } else { diff --git a/src/parsers.zig b/src/parsers.zig index 391b48e..1f19895 100644 --- a/src/parsers.zig +++ b/src/parsers.zig @@ -94,7 +94,7 @@ pub const Parser = struct { self.tokens.deinit(); } - fn setErrContext(self: *Parser, comptime fmt: ?[]const u8, args: var) void { + fn setErrContext(self: *Parser, comptime fmt: ?[]const u8, args: anytype) void { if (fmt == null) { self.err_ctx = null; return; @@ -104,7 +104,7 @@ pub const Parser = struct { self.err_ctx = std.fmt.bufPrint(buf, fmt.?, args) catch unreachable; } - fn doError(self: *Parser, comptime fmt: []const u8, args: var) ParseError { + fn doError(self: *Parser, comptime fmt: []const u8, args: anytype) ParseError { self.hadError = true; std.debug.warn("parser error at line {}", .{self.scanner.line});