Skip to content

syntax: functions require return type. remove -> #720

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

Merged
merged 1 commit into from
Jan 25, 2018
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
14 changes: 7 additions & 7 deletions build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const ArrayList = std.ArrayList;
const Buffer = std.Buffer;
const io = std.io;

pub fn build(b: &Builder) -> %void {
pub fn build(b: &Builder) %void {
const mode = b.standardReleaseOptions();

var docgen_exe = b.addExecutable("docgen", "doc/docgen.zig");
Expand Down Expand Up @@ -121,7 +121,7 @@ pub fn build(b: &Builder) -> %void {
test_step.dependOn(tests.addGenHTests(b, test_filter));
}

fn dependOnLib(lib_exe_obj: &std.build.LibExeObjStep, dep: &const LibraryDep) {
fn dependOnLib(lib_exe_obj: &std.build.LibExeObjStep, dep: &const LibraryDep) void {
for (dep.libdirs.toSliceConst()) |lib_dir| {
lib_exe_obj.addLibPath(lib_dir);
}
Expand All @@ -136,7 +136,7 @@ fn dependOnLib(lib_exe_obj: &std.build.LibExeObjStep, dep: &const LibraryDep) {
}
}

fn addCppLib(b: &Builder, lib_exe_obj: &std.build.LibExeObjStep, cmake_binary_dir: []const u8, lib_name: []const u8) {
fn addCppLib(b: &Builder, lib_exe_obj: &std.build.LibExeObjStep, cmake_binary_dir: []const u8, lib_name: []const u8) void {
const lib_prefix = if (lib_exe_obj.target.isWindows()) "" else "lib";
lib_exe_obj.addObjectFile(os.path.join(b.allocator, cmake_binary_dir, "zig_cpp",
b.fmt("{}{}{}", lib_prefix, lib_name, lib_exe_obj.target.libFileExt())) catch unreachable);
Expand All @@ -149,7 +149,7 @@ const LibraryDep = struct {
includes: ArrayList([]const u8),
};

fn findLLVM(b: &Builder, llvm_config_exe: []const u8) -> %LibraryDep {
fn findLLVM(b: &Builder, llvm_config_exe: []const u8) %LibraryDep {
const libs_output = try b.exec([][]const u8{llvm_config_exe, "--libs", "--system-libs"});
const includes_output = try b.exec([][]const u8{llvm_config_exe, "--includedir"});
const libdir_output = try b.exec([][]const u8{llvm_config_exe, "--libdir"});
Expand Down Expand Up @@ -197,7 +197,7 @@ fn findLLVM(b: &Builder, llvm_config_exe: []const u8) -> %LibraryDep {
return result;
}

pub fn installStdLib(b: &Builder, stdlib_files: []const u8) {
pub fn installStdLib(b: &Builder, stdlib_files: []const u8) void {
var it = mem.split(stdlib_files, ";");
while (it.next()) |stdlib_file| {
const src_path = os.path.join(b.allocator, "std", stdlib_file) catch unreachable;
Expand All @@ -206,7 +206,7 @@ pub fn installStdLib(b: &Builder, stdlib_files: []const u8) {
}
}

pub fn installCHeaders(b: &Builder, c_header_files: []const u8) {
pub fn installCHeaders(b: &Builder, c_header_files: []const u8) void {
var it = mem.split(c_header_files, ";");
while (it.next()) |c_header_file| {
const src_path = os.path.join(b.allocator, "c_headers", c_header_file) catch unreachable;
Expand All @@ -215,7 +215,7 @@ pub fn installCHeaders(b: &Builder, c_header_files: []const u8) {
}
}

fn nextValue(index: &usize, build_info: []const u8) -> []const u8 {
fn nextValue(index: &usize, build_info: []const u8) []const u8 {
const start = *index;
while (true) : (*index += 1) {
switch (build_info[*index]) {
Expand Down
26 changes: 13 additions & 13 deletions doc/docgen.zig
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const exe_ext = std.build.Target(std.build.Target.Native).exeFileExt();
const obj_ext = std.build.Target(std.build.Target.Native).oFileExt();
const tmp_dir_name = "docgen_tmp";

pub fn main() -> %void {
pub fn main() %void {
// TODO use a more general purpose allocator here
var inc_allocator = try std.heap.IncrementingAllocator.init(max_doc_file_size);
defer inc_allocator.deinit();
Expand Down Expand Up @@ -91,7 +91,7 @@ const Tokenizer = struct {
Eof,
};

fn init(source_file_name: []const u8, buffer: []const u8) -> Tokenizer {
fn init(source_file_name: []const u8, buffer: []const u8) Tokenizer {
return Tokenizer {
.buffer = buffer,
.index = 0,
Expand All @@ -101,7 +101,7 @@ const Tokenizer = struct {
};
}

fn next(self: &Tokenizer) -> Token {
fn next(self: &Tokenizer) Token {
var result = Token {
.id = Token.Id.Eof,
.start = self.index,
Expand Down Expand Up @@ -193,7 +193,7 @@ const Tokenizer = struct {
line_end: usize,
};

fn getTokenLocation(self: &Tokenizer, token: &const Token) -> Location {
fn getTokenLocation(self: &Tokenizer, token: &const Token) Location {
var loc = Location {
.line = 0,
.column = 0,
Expand All @@ -220,7 +220,7 @@ const Tokenizer = struct {

error ParseError;

fn parseError(tokenizer: &Tokenizer, token: &const Token, comptime fmt: []const u8, args: ...) -> error {
fn parseError(tokenizer: &Tokenizer, token: &const Token, comptime fmt: []const u8, args: ...) error {
const loc = tokenizer.getTokenLocation(token);
warn("{}:{}:{}: error: " ++ fmt ++ "\n", tokenizer.source_file_name, loc.line + 1, loc.column + 1, args);
if (loc.line_start <= loc.line_end) {
Expand All @@ -243,13 +243,13 @@ fn parseError(tokenizer: &Tokenizer, token: &const Token, comptime fmt: []const
return error.ParseError;
}

fn assertToken(tokenizer: &Tokenizer, token: &const Token, id: Token.Id) -> %void {
fn assertToken(tokenizer: &Tokenizer, token: &const Token, id: Token.Id) %void {
if (token.id != id) {
return parseError(tokenizer, token, "expected {}, found {}", @tagName(id), @tagName(token.id));
}
}

fn eatToken(tokenizer: &Tokenizer, id: Token.Id) -> %Token {
fn eatToken(tokenizer: &Tokenizer, id: Token.Id) %Token {
const token = tokenizer.next();
try assertToken(tokenizer, token, id);
return token;
Expand Down Expand Up @@ -316,7 +316,7 @@ const Action = enum {
Close,
};

fn genToc(allocator: &mem.Allocator, tokenizer: &Tokenizer) -> %Toc {
fn genToc(allocator: &mem.Allocator, tokenizer: &Tokenizer) %Toc {
var urls = std.HashMap([]const u8, Token, mem.hash_slice_u8, mem.eql_slice_u8).init(allocator);
errdefer urls.deinit();

Expand Down Expand Up @@ -540,7 +540,7 @@ fn genToc(allocator: &mem.Allocator, tokenizer: &Tokenizer) -> %Toc {
};
}

fn urlize(allocator: &mem.Allocator, input: []const u8) -> %[]u8 {
fn urlize(allocator: &mem.Allocator, input: []const u8) %[]u8 {
var buf = try std.Buffer.initSize(allocator, 0);
defer buf.deinit();

Expand All @@ -560,7 +560,7 @@ fn urlize(allocator: &mem.Allocator, input: []const u8) -> %[]u8 {
return buf.toOwnedSlice();
}

fn escapeHtml(allocator: &mem.Allocator, input: []const u8) -> %[]u8 {
fn escapeHtml(allocator: &mem.Allocator, input: []const u8) %[]u8 {
var buf = try std.Buffer.initSize(allocator, 0);
defer buf.deinit();

Expand Down Expand Up @@ -604,7 +604,7 @@ test "term color" {
assert(mem.eql(u8, result, "A<span class=\"t32\">green</span>B"));
}

fn termColor(allocator: &mem.Allocator, input: []const u8) -> %[]u8 {
fn termColor(allocator: &mem.Allocator, input: []const u8) %[]u8 {
var buf = try std.Buffer.initSize(allocator, 0);
defer buf.deinit();

Expand Down Expand Up @@ -686,7 +686,7 @@ fn termColor(allocator: &mem.Allocator, input: []const u8) -> %[]u8 {

error ExampleFailedToCompile;

fn genHtml(allocator: &mem.Allocator, tokenizer: &Tokenizer, toc: &Toc, out: &io.OutStream, zig_exe: []const u8) -> %void {
fn genHtml(allocator: &mem.Allocator, tokenizer: &Tokenizer, toc: &Toc, out: &io.OutStream, zig_exe: []const u8) %void {
var code_progress_index: usize = 0;
for (toc.nodes) |node| {
switch (node) {
Expand Down Expand Up @@ -977,7 +977,7 @@ fn genHtml(allocator: &mem.Allocator, tokenizer: &Tokenizer, toc: &Toc, out: &io
error ChildCrashed;
error ChildExitError;

fn exec(allocator: &mem.Allocator, args: []const []const u8) -> %os.ChildProcess.ExecResult {
fn exec(allocator: &mem.Allocator, args: []const []const u8) %os.ChildProcess.ExecResult {
const result = try os.ChildProcess.exec(allocator, args, null, null, max_doc_file_size);
switch (result.term) {
os.ChildProcess.Term.Exited => |exit_code| {
Expand Down
Loading