Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename 'var' type to 'anytype' #5846

Merged
merged 6 commits into from
Jul 12, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ pub fn build(b: *Builder) !void {
test_step.dependOn(docs_step);
}

fn dependOnLib(b: *Builder, lib_exe_obj: var, dep: LibraryDep) void {
fn dependOnLib(b: *Builder, lib_exe_obj: anytype, dep: LibraryDep) void {
for (dep.libdirs.items) |lib_dir| {
lib_exe_obj.addLibPath(lib_dir);
}
Expand Down Expand Up @@ -193,7 +193,7 @@ fn fileExists(filename: []const u8) !bool {
return true;
}

fn addCppLib(b: *Builder, lib_exe_obj: var, cmake_binary_dir: []const u8, lib_name: []const u8) void {
fn addCppLib(b: *Builder, lib_exe_obj: anytype, cmake_binary_dir: []const u8, lib_name: []const u8) void {
lib_exe_obj.addObjectFile(fs.path.join(b.allocator, &[_][]const u8{
cmake_binary_dir,
"zig_cpp",
Expand Down Expand Up @@ -275,7 +275,7 @@ fn findLLVM(b: *Builder, llvm_config_exe: []const u8) !LibraryDep {
return result;
}

fn configureStage2(b: *Builder, exe: var, ctx: Context) !void {
fn configureStage2(b: *Builder, exe: anytype, ctx: Context) !void {
exe.addIncludeDir("src");
exe.addIncludeDir(ctx.cmake_binary_dir);
addCppLib(b, exe, ctx.cmake_binary_dir, "zig_cpp");
Expand Down Expand Up @@ -340,7 +340,7 @@ fn configureStage2(b: *Builder, exe: var, ctx: Context) !void {
fn addCxxKnownPath(
b: *Builder,
ctx: Context,
exe: var,
exe: anytype,
objname: []const u8,
errtxt: ?[]const u8,
) !void {
Expand Down
11 changes: 6 additions & 5 deletions doc/docgen.zig
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ const Tokenizer = struct {
}
};

fn parseError(tokenizer: *Tokenizer, token: Token, comptime fmt: []const u8, args: var) anyerror {
fn parseError(tokenizer: *Tokenizer, token: Token, comptime fmt: []const u8, args: anytype) anyerror {
const loc = tokenizer.getTokenLocation(token);
const args_prefix = .{ tokenizer.source_file_name, loc.line + 1, loc.column + 1 };
warn("{}:{}:{}: error: " ++ fmt ++ "\n", args_prefix ++ args);
Expand Down Expand Up @@ -634,7 +634,7 @@ fn escapeHtml(allocator: *mem.Allocator, input: []const u8) ![]u8 {
return buf.toOwnedSlice();
}

fn writeEscaped(out: var, input: []const u8) !void {
fn writeEscaped(out: anytype, input: []const u8) !void {
for (input) |c| {
try switch (c) {
'&' => out.writeAll("&"),
Expand Down Expand Up @@ -765,7 +765,7 @@ fn isType(name: []const u8) bool {
return false;
}

fn tokenizeAndPrintRaw(docgen_tokenizer: *Tokenizer, out: var, source_token: Token, raw_src: []const u8) !void {
fn tokenizeAndPrintRaw(docgen_tokenizer: *Tokenizer, out: anytype, source_token: Token, raw_src: []const u8) !void {
const src = mem.trim(u8, raw_src, " \n");
try out.writeAll("<code class=\"zig\">");
var tokenizer = std.zig.Tokenizer.init(src);
Expand Down Expand Up @@ -825,6 +825,7 @@ fn tokenizeAndPrintRaw(docgen_tokenizer: *Tokenizer, out: var, source_token: Tok
.Keyword_volatile,
.Keyword_allowzero,
.Keyword_while,
.Keyword_anytype,
=> {
try out.writeAll("<span class=\"tok-kw\">");
try writeEscaped(out, src[token.loc.start..token.loc.end]);
Expand Down Expand Up @@ -977,12 +978,12 @@ fn tokenizeAndPrintRaw(docgen_tokenizer: *Tokenizer, out: var, source_token: Tok
try out.writeAll("</code>");
}

fn tokenizeAndPrint(docgen_tokenizer: *Tokenizer, out: var, source_token: Token) !void {
fn tokenizeAndPrint(docgen_tokenizer: *Tokenizer, out: anytype, source_token: Token) !void {
const raw_src = docgen_tokenizer.buffer[source_token.start..source_token.end];
return tokenizeAndPrintRaw(docgen_tokenizer, out, source_token, raw_src);
}

fn genHtml(allocator: *mem.Allocator, tokenizer: *Tokenizer, toc: *Toc, out: var, zig_exe: []const u8) !void {
fn genHtml(allocator: *mem.Allocator, tokenizer: *Tokenizer, toc: *Toc, out: anytype, zig_exe: []const u8) !void {
var code_progress_index: usize = 0;

var env_map = try process.getEnvMap(allocator);
Expand Down
Loading