| author | |
| committer | |
| log | 5c094d7390a7225f942032992b6070dcb6b9f761 |
| tree | 9edaf26aabc9a5117828e1af4cd2f5d3bab47c91 |
| parent | b6a679c0edd74d996bd0c1769cf4b161b4d42c4d |
...the exports of std.
closes #35611 files changed, 201 insertions(+), 188 deletions(-)
CMakeLists.txt+1-1| ... | ... | @@ -196,6 +196,7 @@ install(TARGETS zig DESTINATION bin) |
| 196 | 196 | |
| 197 | 197 | install(FILES ${C_HEADERS} DESTINATION ${C_HEADERS_DEST}) |
| 198 | 198 | |
| 199 | install(FILES "${CMAKE_SOURCE_DIR}/std/array_list.zig" DESTINATION "${ZIG_STD_DEST}") | |
| 199 | 200 | install(FILES "${CMAKE_SOURCE_DIR}/std/base64.zig" DESTINATION "${ZIG_STD_DEST}") |
| 200 | 201 | install(FILES "${CMAKE_SOURCE_DIR}/std/buf_map.zig" DESTINATION "${ZIG_STD_DEST}") |
| 201 | 202 | install(FILES "${CMAKE_SOURCE_DIR}/std/buf_set.zig" DESTINATION "${ZIG_STD_DEST}") |
| ... | ... | @@ -216,7 +217,6 @@ install(FILES "${CMAKE_SOURCE_DIR}/std/hash_map.zig" DESTINATION "${ZIG_STD_DEST |
| 216 | 217 | install(FILES "${CMAKE_SOURCE_DIR}/std/index.zig" DESTINATION "${ZIG_STD_DEST}") |
| 217 | 218 | install(FILES "${CMAKE_SOURCE_DIR}/std/io.zig" DESTINATION "${ZIG_STD_DEST}") |
| 218 | 219 | install(FILES "${CMAKE_SOURCE_DIR}/std/linked_list.zig" DESTINATION "${ZIG_STD_DEST}") |
| 219 | install(FILES "${CMAKE_SOURCE_DIR}/std/list.zig" DESTINATION "${ZIG_STD_DEST}") | |
| 220 | 220 | install(FILES "${CMAKE_SOURCE_DIR}/std/math.zig" DESTINATION "${ZIG_STD_DEST}") |
| 221 | 221 | install(FILES "${CMAKE_SOURCE_DIR}/std/mem.zig" DESTINATION "${ZIG_STD_DEST}") |
| 222 | 222 | install(FILES "${CMAKE_SOURCE_DIR}/std/net.zig" DESTINATION "${ZIG_STD_DEST}") |
std/array_list.zig created+91| ... | ... | @@ -0,0 +1,91 @@ |
| 1 | const debug = @import("debug.zig"); | |
| 2 | const assert = debug.assert; | |
| 3 | const mem = @import("mem.zig"); | |
| 4 | const Allocator = mem.Allocator; | |
| 5 | ||
| 6 | pub fn ArrayList(comptime T: type) -> type{ | |
| 7 | struct { | |
| 8 | const Self = this; | |
| 9 | ||
| 10 | /// Use toSlice instead of slicing this directly, because if you don't | |
| 11 | /// specify the end position of the slice, this will potentially give | |
| 12 | /// you uninitialized memory. | |
| 13 | items: []T, | |
| 14 | len: usize, | |
| 15 | allocator: &Allocator, | |
| 16 | ||
| 17 | pub fn init(allocator: &Allocator) -> Self { | |
| 18 | Self { | |
| 19 | .items = []T{}, | |
| 20 | .len = 0, | |
| 21 | .allocator = allocator, | |
| 22 | } | |
| 23 | } | |
| 24 | ||
| 25 | pub fn deinit(l: &Self) { | |
| 26 | l.allocator.free(l.items); | |
| 27 | } | |
| 28 | ||
| 29 | pub fn toSlice(l: &Self) -> []T { | |
| 30 | return l.items[0...l.len]; | |
| 31 | } | |
| 32 | ||
| 33 | pub fn toSliceConst(l: &const Self) -> []const T { | |
| 34 | return l.items[0...l.len]; | |
| 35 | } | |
| 36 | ||
| 37 | pub fn append(l: &Self, item: &const T) -> %void { | |
| 38 | const new_item_ptr = %return l.addOne(); | |
| 39 | *new_item_ptr = *item; | |
| 40 | } | |
| 41 | ||
| 42 | pub fn resize(l: &Self, new_len: usize) -> %void { | |
| 43 | %return l.ensureCapacity(new_len); | |
| 44 | l.len = new_len; | |
| 45 | } | |
| 46 | ||
| 47 | pub fn resizeDown(l: &Self, new_len: usize) { | |
| 48 | assert(new_len <= l.len); | |
| 49 | l.len = new_len; | |
| 50 | } | |
| 51 | ||
| 52 | pub fn ensureCapacity(l: &Self, new_capacity: usize) -> %void { | |
| 53 | var better_capacity = l.items.len; | |
| 54 | if (better_capacity >= new_capacity) return; | |
| 55 | while (true) { | |
| 56 | better_capacity += better_capacity / 2 + 8; | |
| 57 | if (better_capacity >= new_capacity) break; | |
| 58 | } | |
| 59 | l.items = %return l.allocator.realloc(T, l.items, better_capacity); | |
| 60 | } | |
| 61 | ||
| 62 | pub fn addOne(l: &Self) -> %&T { | |
| 63 | const new_length = l.len + 1; | |
| 64 | %return l.ensureCapacity(new_length); | |
| 65 | const result = &l.items[l.len]; | |
| 66 | l.len = new_length; | |
| 67 | return result; | |
| 68 | } | |
| 69 | ||
| 70 | pub fn pop(self: &Self) -> T { | |
| 71 | self.len -= 1; | |
| 72 | return self.items[self.len]; | |
| 73 | } | |
| 74 | } | |
| 75 | } | |
| 76 | ||
| 77 | test "basic ArrayList test" { | |
| 78 | var list = ArrayList(i32).init(&debug.global_allocator); | |
| 79 | defer list.deinit(); | |
| 80 | ||
| 81 | {var i: usize = 0; while (i < 10) : (i += 1) { | |
| 82 | %%list.append(i32(i + 1)); | |
| 83 | }} | |
| 84 | ||
| 85 | {var i: usize = 0; while (i < 10) : (i += 1) { | |
| 86 | assert(list.items[i] == i32(i + 1)); | |
| 87 | }} | |
| 88 | ||
| 89 | assert(list.pop() == 10); | |
| 90 | assert(list.len == 9); | |
| 91 | } |
std/buffer.zig+3-3| ... | ... | @@ -2,11 +2,11 @@ const debug = @import("debug.zig"); |
| 2 | 2 | const mem = @import("mem.zig"); |
| 3 | 3 | const Allocator = mem.Allocator; |
| 4 | 4 | const assert = debug.assert; |
| 5 | const List = @import("list.zig").List; | |
| 5 | const ArrayList = @import("array_list.zig").ArrayList; | |
| 6 | 6 | |
| 7 | 7 | /// A buffer that allocates memory and maintains a null byte at the end. |
| 8 | 8 | pub const Buffer = struct { |
| 9 | list: List(u8), | |
| 9 | list: ArrayList(u8), | |
| 10 | 10 | |
| 11 | 11 | /// Must deinitialize with deinit. |
| 12 | 12 | pub fn init(allocator: &Allocator, m: []const u8) -> %Buffer { |
| ... | ... | @@ -29,7 +29,7 @@ pub const Buffer = struct { |
| 29 | 29 | /// * ::resize |
| 30 | 30 | pub fn initNull(allocator: &Allocator) -> Buffer { |
| 31 | 31 | Buffer { |
| 32 | .list = List(u8).init(allocator), | |
| 32 | .list = ArrayList(u8).init(allocator), | |
| 33 | 33 | } |
| 34 | 34 | } |
| 35 | 35 |
std/build.zig+38-38| ... | ... | @@ -3,7 +3,7 @@ const io = @import("io.zig"); |
| 3 | 3 | const mem = @import("mem.zig"); |
| 4 | 4 | const debug = @import("debug.zig"); |
| 5 | 5 | const assert = debug.assert; |
| 6 | const List = @import("list.zig").List; | |
| 6 | const ArrayList = @import("array_list.zig").ArrayList; | |
| 7 | 7 | const HashMap = @import("hash_map.zig").HashMap; |
| 8 | 8 | const Allocator = @import("mem.zig").Allocator; |
| 9 | 9 | const os = @import("os/index.zig"); |
| ... | ... | @@ -26,22 +26,22 @@ pub const Builder = struct { |
| 26 | 26 | have_uninstall_step: bool, |
| 27 | 27 | have_install_step: bool, |
| 28 | 28 | allocator: &Allocator, |
| 29 | lib_paths: List([]const u8), | |
| 30 | include_paths: List([]const u8), | |
| 31 | rpaths: List([]const u8), | |
| 29 | lib_paths: ArrayList([]const u8), | |
| 30 | include_paths: ArrayList([]const u8), | |
| 31 | rpaths: ArrayList([]const u8), | |
| 32 | 32 | user_input_options: UserInputOptionsMap, |
| 33 | 33 | available_options_map: AvailableOptionsMap, |
| 34 | available_options_list: List(AvailableOption), | |
| 34 | available_options_list: ArrayList(AvailableOption), | |
| 35 | 35 | verbose: bool, |
| 36 | 36 | invalid_user_input: bool, |
| 37 | 37 | zig_exe: []const u8, |
| 38 | 38 | default_step: &Step, |
| 39 | 39 | env_map: BufMap, |
| 40 | top_level_steps: List(&TopLevelStep), | |
| 40 | top_level_steps: ArrayList(&TopLevelStep), | |
| 41 | 41 | prefix: []const u8, |
| 42 | 42 | lib_dir: []const u8, |
| 43 | 43 | exe_dir: []const u8, |
| 44 | installed_files: List([]const u8), | |
| 44 | installed_files: ArrayList([]const u8), | |
| 45 | 45 | build_root: []const u8, |
| 46 | 46 | cache_root: []const u8, |
| 47 | 47 | |
| ... | ... | @@ -63,7 +63,7 @@ pub const Builder = struct { |
| 63 | 63 | const UserValue = enum { |
| 64 | 64 | Flag, |
| 65 | 65 | Scalar: []const u8, |
| 66 | List: List([]const u8), | |
| 66 | List: ArrayList([]const u8), | |
| 67 | 67 | }; |
| 68 | 68 | |
| 69 | 69 | const TypeId = enum { |
| ... | ... | @@ -89,19 +89,19 @@ pub const Builder = struct { |
| 89 | 89 | .verbose = false, |
| 90 | 90 | .invalid_user_input = false, |
| 91 | 91 | .allocator = allocator, |
| 92 | .lib_paths = List([]const u8).init(allocator), | |
| 93 | .include_paths = List([]const u8).init(allocator), | |
| 94 | .rpaths = List([]const u8).init(allocator), | |
| 92 | .lib_paths = ArrayList([]const u8).init(allocator), | |
| 93 | .include_paths = ArrayList([]const u8).init(allocator), | |
| 94 | .rpaths = ArrayList([]const u8).init(allocator), | |
| 95 | 95 | .user_input_options = UserInputOptionsMap.init(allocator), |
| 96 | 96 | .available_options_map = AvailableOptionsMap.init(allocator), |
| 97 | .available_options_list = List(AvailableOption).init(allocator), | |
| 98 | .top_level_steps = List(&TopLevelStep).init(allocator), | |
| 97 | .available_options_list = ArrayList(AvailableOption).init(allocator), | |
| 98 | .top_level_steps = ArrayList(&TopLevelStep).init(allocator), | |
| 99 | 99 | .default_step = undefined, |
| 100 | 100 | .env_map = %%os.getEnvMap(allocator), |
| 101 | 101 | .prefix = undefined, |
| 102 | 102 | .lib_dir = undefined, |
| 103 | 103 | .exe_dir = undefined, |
| 104 | .installed_files = List([]const u8).init(allocator), | |
| 104 | .installed_files = ArrayList([]const u8).init(allocator), | |
| 105 | 105 | .uninstall_tls = TopLevelStep { |
| 106 | 106 | .step = Step.init("uninstall", allocator, makeUninstall), |
| 107 | 107 | .description = "Remove build artifacts from prefix path", |
| ... | ... | @@ -225,7 +225,7 @@ pub const Builder = struct { |
| 225 | 225 | } |
| 226 | 226 | |
| 227 | 227 | pub fn make(self: &Builder, step_names: []const []const u8) -> %void { |
| 228 | var wanted_steps = List(&Step).init(self.allocator); | |
| 228 | var wanted_steps = ArrayList(&Step).init(self.allocator); | |
| 229 | 229 | defer wanted_steps.deinit(); |
| 230 | 230 | |
| 231 | 231 | if (step_names.len == 0) { |
| ... | ... | @@ -433,7 +433,7 @@ pub const Builder = struct { |
| 433 | 433 | switch (prev_value.value) { |
| 434 | 434 | UserValue.Scalar => |s| { |
| 435 | 435 | // turn it into a list |
| 436 | var list = List([]const u8).init(self.allocator); | |
| 436 | var list = ArrayList([]const u8).init(self.allocator); | |
| 437 | 437 | %%list.append(s); |
| 438 | 438 | %%list.append(value); |
| 439 | 439 | _ = %%self.user_input_options.put(name, UserInputOption { |
| ... | ... | @@ -695,9 +695,9 @@ pub const LibExeObjStep = struct { |
| 695 | 695 | out_filename: []const u8, |
| 696 | 696 | major_only_filename: []const u8, |
| 697 | 697 | name_only_filename: []const u8, |
| 698 | object_files: List([]const u8), | |
| 699 | assembly_files: List([]const u8), | |
| 700 | packages: List(Pkg), | |
| 698 | object_files: ArrayList([]const u8), | |
| 699 | assembly_files: ArrayList([]const u8), | |
| 700 | packages: ArrayList(Pkg), | |
| 701 | 701 | |
| 702 | 702 | const Pkg = struct { |
| 703 | 703 | name: []const u8, |
| ... | ... | @@ -758,9 +758,9 @@ pub const LibExeObjStep = struct { |
| 758 | 758 | .out_h_filename = builder.fmt("{}.h", name), |
| 759 | 759 | .major_only_filename = undefined, |
| 760 | 760 | .name_only_filename = undefined, |
| 761 | .object_files = List([]const u8).init(builder.allocator), | |
| 762 | .assembly_files = List([]const u8).init(builder.allocator), | |
| 763 | .packages = List(Pkg).init(builder.allocator), | |
| 761 | .object_files = ArrayList([]const u8).init(builder.allocator), | |
| 762 | .assembly_files = ArrayList([]const u8).init(builder.allocator), | |
| 763 | .packages = ArrayList(Pkg).init(builder.allocator), | |
| 764 | 764 | }; |
| 765 | 765 | self.computeOutFileNames(); |
| 766 | 766 | return self; |
| ... | ... | @@ -875,7 +875,7 @@ pub const LibExeObjStep = struct { |
| 875 | 875 | return error.NeedAnObject; |
| 876 | 876 | } |
| 877 | 877 | |
| 878 | var zig_args = List([]const u8).init(builder.allocator); | |
| 878 | var zig_args = ArrayList([]const u8).init(builder.allocator); | |
| 879 | 879 | defer zig_args.deinit(); |
| 880 | 880 | |
| 881 | 881 | const cmd = switch (self.kind) { |
| ... | ... | @@ -1043,7 +1043,7 @@ pub const TestStep = struct { |
| 1043 | 1043 | const self = @fieldParentPtr(TestStep, "step", step); |
| 1044 | 1044 | const builder = self.builder; |
| 1045 | 1045 | |
| 1046 | var zig_args = List([]const u8).init(builder.allocator); | |
| 1046 | var zig_args = ArrayList([]const u8).init(builder.allocator); | |
| 1047 | 1047 | defer zig_args.deinit(); |
| 1048 | 1048 | |
| 1049 | 1049 | %%zig_args.append("test"); |
| ... | ... | @@ -1104,14 +1104,14 @@ pub const CLibExeObjStep = struct { |
| 1104 | 1104 | output_path: ?[]const u8, |
| 1105 | 1105 | static: bool, |
| 1106 | 1106 | version: Version, |
| 1107 | cflags: List([]const u8), | |
| 1108 | source_files: List([]const u8), | |
| 1109 | object_files: List([]const u8), | |
| 1107 | cflags: ArrayList([]const u8), | |
| 1108 | source_files: ArrayList([]const u8), | |
| 1109 | object_files: ArrayList([]const u8), | |
| 1110 | 1110 | link_libs: BufSet, |
| 1111 | full_path_libs: List([]const u8), | |
| 1111 | full_path_libs: ArrayList([]const u8), | |
| 1112 | 1112 | target: Target, |
| 1113 | 1113 | builder: &Builder, |
| 1114 | include_dirs: List([]const u8), | |
| 1114 | include_dirs: ArrayList([]const u8), | |
| 1115 | 1115 | major_only_filename: []const u8, |
| 1116 | 1116 | name_only_filename: []const u8, |
| 1117 | 1117 | object_src: []const u8, |
| ... | ... | @@ -1158,13 +1158,13 @@ pub const CLibExeObjStep = struct { |
| 1158 | 1158 | .version = *version, |
| 1159 | 1159 | .static = static, |
| 1160 | 1160 | .target = Target.Native, |
| 1161 | .cflags = List([]const u8).init(builder.allocator), | |
| 1162 | .source_files = List([]const u8).init(builder.allocator), | |
| 1163 | .object_files = List([]const u8).init(builder.allocator), | |
| 1161 | .cflags = ArrayList([]const u8).init(builder.allocator), | |
| 1162 | .source_files = ArrayList([]const u8).init(builder.allocator), | |
| 1163 | .object_files = ArrayList([]const u8).init(builder.allocator), | |
| 1164 | 1164 | .step = Step.init(name, builder.allocator, make), |
| 1165 | 1165 | .link_libs = BufSet.init(builder.allocator), |
| 1166 | .full_path_libs = List([]const u8).init(builder.allocator), | |
| 1167 | .include_dirs = List([]const u8).init(builder.allocator), | |
| 1166 | .full_path_libs = ArrayList([]const u8).init(builder.allocator), | |
| 1167 | .include_dirs = ArrayList([]const u8).init(builder.allocator), | |
| 1168 | 1168 | .output_path = null, |
| 1169 | 1169 | .out_filename = undefined, |
| 1170 | 1170 | .major_only_filename = undefined, |
| ... | ... | @@ -1267,7 +1267,7 @@ pub const CLibExeObjStep = struct { |
| 1267 | 1267 | } |
| 1268 | 1268 | } |
| 1269 | 1269 | |
| 1270 | fn appendCompileFlags(self: &CLibExeObjStep, args: &List([]const u8)) { | |
| 1270 | fn appendCompileFlags(self: &CLibExeObjStep, args: &ArrayList([]const u8)) { | |
| 1271 | 1271 | if (!self.strip) { |
| 1272 | 1272 | %%args.append("-g"); |
| 1273 | 1273 | } |
| ... | ... | @@ -1300,7 +1300,7 @@ pub const CLibExeObjStep = struct { |
| 1300 | 1300 | const cc = os.getEnv("CC") ?? "cc"; |
| 1301 | 1301 | const builder = self.builder; |
| 1302 | 1302 | |
| 1303 | var cc_args = List([]const u8).init(builder.allocator); | |
| 1303 | var cc_args = ArrayList([]const u8).init(builder.allocator); | |
| 1304 | 1304 | defer cc_args.deinit(); |
| 1305 | 1305 | |
| 1306 | 1306 | switch (self.kind) { |
| ... | ... | @@ -1646,7 +1646,7 @@ pub const RemoveDirStep = struct { |
| 1646 | 1646 | pub const Step = struct { |
| 1647 | 1647 | name: []const u8, |
| 1648 | 1648 | makeFn: fn(self: &Step) -> %void, |
| 1649 | dependencies: List(&Step), | |
| 1649 | dependencies: ArrayList(&Step), | |
| 1650 | 1650 | loop_flag: bool, |
| 1651 | 1651 | done_flag: bool, |
| 1652 | 1652 | |
| ... | ... | @@ -1654,7 +1654,7 @@ pub const Step = struct { |
| 1654 | 1654 | Step { |
| 1655 | 1655 | .name = name, |
| 1656 | 1656 | .makeFn = makeFn, |
| 1657 | .dependencies = List(&Step).init(allocator), | |
| 1657 | .dependencies = ArrayList(&Step).init(allocator), | |
| 1658 | 1658 | .loop_flag = false, |
| 1659 | 1659 | .done_flag = false, |
| 1660 | 1660 | } |
std/debug.zig+15-15| ... | ... | @@ -3,7 +3,7 @@ const io = @import("io.zig"); |
| 3 | 3 | const os = @import("os/index.zig"); |
| 4 | 4 | const elf = @import("elf.zig"); |
| 5 | 5 | const DW = @import("dwarf.zig"); |
| 6 | const List = @import("list.zig").List; | |
| 6 | const ArrayList = @import("array_list.zig").ArrayList; | |
| 7 | 7 | const builtin = @import("builtin"); |
| 8 | 8 | |
| 9 | 9 | error MissingDebugInfo; |
| ... | ... | @@ -60,8 +60,8 @@ pub fn writeStackTrace(out_stream: &io.OutStream, allocator: &mem.Allocator, tty |
| 60 | 60 | .debug_abbrev = undefined, |
| 61 | 61 | .debug_str = undefined, |
| 62 | 62 | .debug_line = undefined, |
| 63 | .abbrev_table_list = List(AbbrevTableHeader).init(allocator), | |
| 64 | .compile_unit_list = List(CompileUnit).init(allocator), | |
| 63 | .abbrev_table_list = ArrayList(AbbrevTableHeader).init(allocator), | |
| 64 | .compile_unit_list = ArrayList(CompileUnit).init(allocator), | |
| 65 | 65 | }; |
| 66 | 66 | const st = &stack_trace; |
| 67 | 67 | st.self_exe_stream = %return io.openSelfExe(); |
| ... | ... | @@ -179,8 +179,8 @@ const ElfStackTrace = struct { |
| 179 | 179 | debug_abbrev: &elf.SectionHeader, |
| 180 | 180 | debug_str: &elf.SectionHeader, |
| 181 | 181 | debug_line: &elf.SectionHeader, |
| 182 | abbrev_table_list: List(AbbrevTableHeader), | |
| 183 | compile_unit_list: List(CompileUnit), | |
| 182 | abbrev_table_list: ArrayList(AbbrevTableHeader), | |
| 183 | compile_unit_list: ArrayList(CompileUnit), | |
| 184 | 184 | |
| 185 | 185 | pub fn allocator(self: &const ElfStackTrace) -> &mem.Allocator { |
| 186 | 186 | return self.abbrev_table_list.allocator; |
| ... | ... | @@ -204,7 +204,7 @@ const CompileUnit = struct { |
| 204 | 204 | pc_range: ?PcRange, |
| 205 | 205 | }; |
| 206 | 206 | |
| 207 | const AbbrevTable = List(AbbrevTableEntry); | |
| 207 | const AbbrevTable = ArrayList(AbbrevTableEntry); | |
| 208 | 208 | |
| 209 | 209 | const AbbrevTableHeader = struct { |
| 210 | 210 | // offset from .debug_abbrev |
| ... | ... | @@ -216,7 +216,7 @@ const AbbrevTableEntry = struct { |
| 216 | 216 | has_children: bool, |
| 217 | 217 | abbrev_code: u64, |
| 218 | 218 | tag_id: u64, |
| 219 | attrs: List(AbbrevAttr), | |
| 219 | attrs: ArrayList(AbbrevAttr), | |
| 220 | 220 | }; |
| 221 | 221 | |
| 222 | 222 | const AbbrevAttr = struct { |
| ... | ... | @@ -254,7 +254,7 @@ const Constant = struct { |
| 254 | 254 | const Die = struct { |
| 255 | 255 | tag_id: u64, |
| 256 | 256 | has_children: bool, |
| 257 | attrs: List(Attr), | |
| 257 | attrs: ArrayList(Attr), | |
| 258 | 258 | |
| 259 | 259 | const Attr = struct { |
| 260 | 260 | id: u64, |
| ... | ... | @@ -324,7 +324,7 @@ const LineNumberProgram = struct { |
| 324 | 324 | |
| 325 | 325 | target_address: usize, |
| 326 | 326 | include_dirs: []const []const u8, |
| 327 | file_entries: &List(FileEntry), | |
| 327 | file_entries: &ArrayList(FileEntry), | |
| 328 | 328 | |
| 329 | 329 | prev_address: usize, |
| 330 | 330 | prev_file: usize, |
| ... | ... | @@ -335,7 +335,7 @@ const LineNumberProgram = struct { |
| 335 | 335 | prev_end_sequence: bool, |
| 336 | 336 | |
| 337 | 337 | pub fn init(is_stmt: bool, include_dirs: []const []const u8, |
| 338 | file_entries: &List(FileEntry), target_address: usize) -> LineNumberProgram | |
| 338 | file_entries: &ArrayList(FileEntry), target_address: usize) -> LineNumberProgram | |
| 339 | 339 | { |
| 340 | 340 | LineNumberProgram { |
| 341 | 341 | .address = 0, |
| ... | ... | @@ -394,7 +394,7 @@ const LineNumberProgram = struct { |
| 394 | 394 | }; |
| 395 | 395 | |
| 396 | 396 | fn readStringRaw(allocator: &mem.Allocator, in_stream: &io.InStream) -> %[]u8 { |
| 397 | var buf = List(u8).init(allocator); | |
| 397 | var buf = ArrayList(u8).init(allocator); | |
| 398 | 398 | while (true) { |
| 399 | 399 | const byte = %return in_stream.readByte(); |
| 400 | 400 | if (byte == 0) |
| ... | ... | @@ -525,7 +525,7 @@ fn parseAbbrevTable(st: &ElfStackTrace) -> %AbbrevTable { |
| 525 | 525 | .abbrev_code = abbrev_code, |
| 526 | 526 | .tag_id = %return readULeb128(in_stream), |
| 527 | 527 | .has_children = (%return in_stream.readByte()) == DW.CHILDREN_yes, |
| 528 | .attrs = List(AbbrevAttr).init(st.allocator()), | |
| 528 | .attrs = ArrayList(AbbrevAttr).init(st.allocator()), | |
| 529 | 529 | }); |
| 530 | 530 | const attrs = &result.items[result.len - 1].attrs; |
| 531 | 531 | |
| ... | ... | @@ -574,7 +574,7 @@ fn parseDie(st: &ElfStackTrace, abbrev_table: &const AbbrevTable, is_64: bool) - |
| 574 | 574 | var result = Die { |
| 575 | 575 | .tag_id = table_entry.tag_id, |
| 576 | 576 | .has_children = table_entry.has_children, |
| 577 | .attrs = List(Die.Attr).init(st.allocator()), | |
| 577 | .attrs = ArrayList(Die.Attr).init(st.allocator()), | |
| 578 | 578 | }; |
| 579 | 579 | %return result.attrs.resize(table_entry.attrs.len); |
| 580 | 580 | for (table_entry.attrs.toSliceConst()) |attr, i| { |
| ... | ... | @@ -632,7 +632,7 @@ fn getLineNumberInfo(st: &ElfStackTrace, compile_unit: &const CompileUnit, targe |
| 632 | 632 | standard_opcode_lengths[i] = %return in_stream.readByte(); |
| 633 | 633 | }} |
| 634 | 634 | |
| 635 | var include_directories = List([]u8).init(st.allocator()); | |
| 635 | var include_directories = ArrayList([]u8).init(st.allocator()); | |
| 636 | 636 | %return include_directories.append(compile_unit_cwd); |
| 637 | 637 | while (true) { |
| 638 | 638 | const dir = %return st.readString(); |
| ... | ... | @@ -641,7 +641,7 @@ fn getLineNumberInfo(st: &ElfStackTrace, compile_unit: &const CompileUnit, targe |
| 641 | 641 | %return include_directories.append(dir); |
| 642 | 642 | } |
| 643 | 643 | |
| 644 | var file_entries = List(FileEntry).init(st.allocator()); | |
| 644 | var file_entries = ArrayList(FileEntry).init(st.allocator()); | |
| 645 | 645 | var prog = LineNumberProgram.init(default_is_stmt, include_directories.toSliceConst(), |
| 646 | 646 | &file_entries, target_address); |
| 647 | 647 |
std/index.zig+21-8| ... | ... | @@ -1,15 +1,21 @@ |
| 1 | pub const ArrayList = @import("array_list.zig").ArrayList; | |
| 2 | pub const BufMap = @import("buf_map.zig").BufMap; | |
| 3 | pub const BufSet = @import("buf_set.zig").BufSet; | |
| 4 | pub const Buffer = @import("buffer.zig").Buffer; | |
| 5 | pub const HashMap = @import("hash_map.zig").HashMap; | |
| 6 | pub const LinkedList = @import("linked_list.zig").LinkedList; | |
| 7 | ||
| 1 | 8 | pub const base64 = @import("base64.zig"); |
| 2 | pub const buffer = @import("buffer.zig"); | |
| 3 | 9 | pub const build = @import("build.zig"); |
| 4 | 10 | pub const c = @import("c/index.zig"); |
| 5 | 11 | pub const cstr = @import("cstr.zig"); |
| 6 | 12 | pub const debug = @import("debug.zig"); |
| 13 | pub const dwarf = @import("dwarf.zig"); | |
| 14 | pub const elf = @import("elf.zig"); | |
| 7 | 15 | pub const empty_import = @import("empty.zig"); |
| 16 | pub const endian = @import("endian.zig"); | |
| 8 | 17 | pub const fmt = @import("fmt.zig"); |
| 9 | pub const hash_map = @import("hash_map.zig"); | |
| 10 | 18 | pub const io = @import("io.zig"); |
| 11 | pub const linked_list = @import("linked_list.zig"); | |
| 12 | pub const list = @import("list.zig"); | |
| 13 | 19 | pub const math = @import("math.zig"); |
| 14 | 20 | pub const mem = @import("mem.zig"); |
| 15 | 21 | pub const net = @import("net.zig"); |
| ... | ... | @@ -20,17 +26,24 @@ pub const target = @import("target.zig"); |
| 20 | 26 | |
| 21 | 27 | test "std" { |
| 22 | 28 | // run tests from these |
| 29 | _ = @import("array_list.zig").ArrayList; | |
| 30 | _ = @import("buf_map.zig").BufMap; | |
| 31 | _ = @import("buf_set.zig").BufSet; | |
| 32 | _ = @import("buffer.zig").Buffer; | |
| 33 | _ = @import("hash_map.zig").HashMap; | |
| 34 | _ = @import("linked_list.zig").LinkedList; | |
| 35 | ||
| 23 | 36 | _ = @import("base64.zig"); |
| 24 | _ = @import("buffer.zig"); | |
| 25 | 37 | _ = @import("build.zig"); |
| 26 | 38 | _ = @import("c/index.zig"); |
| 27 | 39 | _ = @import("cstr.zig"); |
| 28 | 40 | _ = @import("debug.zig"); |
| 41 | _ = @import("dwarf.zig"); | |
| 42 | _ = @import("elf.zig"); | |
| 43 | _ = @import("empty.zig"); | |
| 44 | _ = @import("endian.zig"); | |
| 29 | 45 | _ = @import("fmt.zig"); |
| 30 | _ = @import("hash_map.zig"); | |
| 31 | 46 | _ = @import("io.zig"); |
| 32 | _ = @import("linked_list.zig"); | |
| 33 | _ = @import("list.zig"); | |
| 34 | 47 | _ = @import("math.zig"); |
| 35 | 48 | _ = @import("mem.zig"); |
| 36 | 49 | _ = @import("net.zig"); |
std/linked_list.zig+13-13| ... | ... | @@ -6,7 +6,7 @@ const Allocator = mem.Allocator; |
| 6 | 6 | /// Generic doubly linked list. |
| 7 | 7 | pub fn LinkedList(comptime T: type) -> type { |
| 8 | 8 | struct { |
| 9 | const List = this; | |
| 9 | const Self = this; | |
| 10 | 10 | |
| 11 | 11 | /// Node inside the linked list wrapping the actual data. |
| 12 | 12 | pub const Node = struct { |
| ... | ... | @@ -27,8 +27,8 @@ pub fn LinkedList(comptime T: type) -> type { |
| 27 | 27 | /// |
| 28 | 28 | /// Returns: |
| 29 | 29 | /// An empty linked list. |
| 30 | pub fn init(allocator: &Allocator) -> List { | |
| 31 | List { | |
| 30 | pub fn init(allocator: &Allocator) -> Self { | |
| 31 | Self { | |
| 32 | 32 | .first = null, |
| 33 | 33 | .last = null, |
| 34 | 34 | .len = 0, |
| ... | ... | @@ -41,7 +41,7 @@ pub fn LinkedList(comptime T: type) -> type { |
| 41 | 41 | /// Arguments: |
| 42 | 42 | /// node: Pointer to a node in the list. |
| 43 | 43 | /// new_node: Pointer to the new node to insert. |
| 44 | pub fn insertAfter(list: &List, node: &Node, new_node: &Node) { | |
| 44 | pub fn insertAfter(list: &Self, node: &Node, new_node: &Node) { | |
| 45 | 45 | new_node.prev = node; |
| 46 | 46 | if (node.next) |next_node| { |
| 47 | 47 | // Intermediate node. |
| ... | ... | @@ -62,7 +62,7 @@ pub fn LinkedList(comptime T: type) -> type { |
| 62 | 62 | /// Arguments: |
| 63 | 63 | /// node: Pointer to a node in the list. |
| 64 | 64 | /// new_node: Pointer to the new node to insert. |
| 65 | pub fn insertBefore(list: &List, node: &Node, new_node: &Node) { | |
| 65 | pub fn insertBefore(list: &Self, node: &Node, new_node: &Node) { | |
| 66 | 66 | new_node.next = node; |
| 67 | 67 | if (node.prev) |prev_node| { |
| 68 | 68 | // Intermediate node. |
| ... | ... | @@ -82,7 +82,7 @@ pub fn LinkedList(comptime T: type) -> type { |
| 82 | 82 | /// |
| 83 | 83 | /// Arguments: |
| 84 | 84 | /// new_node: Pointer to the new node to insert. |
| 85 | pub fn append(list: &List, new_node: &Node) { | |
| 85 | pub fn append(list: &Self, new_node: &Node) { | |
| 86 | 86 | if (list.last) |last| { |
| 87 | 87 | // Insert after last. |
| 88 | 88 | list.insertAfter(last, new_node); |
| ... | ... | @@ -96,7 +96,7 @@ pub fn LinkedList(comptime T: type) -> type { |
| 96 | 96 | /// |
| 97 | 97 | /// Arguments: |
| 98 | 98 | /// new_node: Pointer to the new node to insert. |
| 99 | pub fn prepend(list: &List, new_node: &Node) { | |
| 99 | pub fn prepend(list: &Self, new_node: &Node) { | |
| 100 | 100 | if (list.first) |first| { |
| 101 | 101 | // Insert before first. |
| 102 | 102 | list.insertBefore(first, new_node); |
| ... | ... | @@ -115,7 +115,7 @@ pub fn LinkedList(comptime T: type) -> type { |
| 115 | 115 | /// |
| 116 | 116 | /// Arguments: |
| 117 | 117 | /// node: Pointer to the node to be removed. |
| 118 | pub fn remove(list: &List, node: &Node) { | |
| 118 | pub fn remove(list: &Self, node: &Node) { | |
| 119 | 119 | if (node.prev) |prev_node| { |
| 120 | 120 | // Intermediate node. |
| 121 | 121 | prev_node.next = node.next; |
| ... | ... | @@ -139,7 +139,7 @@ pub fn LinkedList(comptime T: type) -> type { |
| 139 | 139 | /// |
| 140 | 140 | /// Returns: |
| 141 | 141 | /// A pointer to the last node in the list. |
| 142 | pub fn pop(list: &List) -> ?&Node { | |
| 142 | pub fn pop(list: &Self) -> ?&Node { | |
| 143 | 143 | const last = list.last ?? return null; |
| 144 | 144 | list.remove(last); |
| 145 | 145 | return last; |
| ... | ... | @@ -149,7 +149,7 @@ pub fn LinkedList(comptime T: type) -> type { |
| 149 | 149 | /// |
| 150 | 150 | /// Returns: |
| 151 | 151 | /// A pointer to the first node in the list. |
| 152 | pub fn popFirst(list: &List) -> ?&Node { | |
| 152 | pub fn popFirst(list: &Self) -> ?&Node { | |
| 153 | 153 | const first = list.first ?? return null; |
| 154 | 154 | list.remove(first); |
| 155 | 155 | return first; |
| ... | ... | @@ -159,7 +159,7 @@ pub fn LinkedList(comptime T: type) -> type { |
| 159 | 159 | /// |
| 160 | 160 | /// Returns: |
| 161 | 161 | /// A pointer to the new node. |
| 162 | pub fn allocateNode(list: &List) -> %&Node { | |
| 162 | pub fn allocateNode(list: &Self) -> %&Node { | |
| 163 | 163 | list.allocator.create(Node) |
| 164 | 164 | } |
| 165 | 165 | |
| ... | ... | @@ -167,7 +167,7 @@ pub fn LinkedList(comptime T: type) -> type { |
| 167 | 167 | /// |
| 168 | 168 | /// Arguments: |
| 169 | 169 | /// node: Pointer to the node to deallocate. |
| 170 | pub fn destroyNode(list: &List, node: &Node) { | |
| 170 | pub fn destroyNode(list: &Self, node: &Node) { | |
| 171 | 171 | list.allocator.destroy(node); |
| 172 | 172 | } |
| 173 | 173 | |
| ... | ... | @@ -178,7 +178,7 @@ pub fn LinkedList(comptime T: type) -> type { |
| 178 | 178 | /// |
| 179 | 179 | /// Returns: |
| 180 | 180 | /// A pointer to the new node. |
| 181 | pub fn createNode(list: &List, data: &const T) -> %&Node { | |
| 181 | pub fn createNode(list: &Self, data: &const T) -> %&Node { | |
| 182 | 182 | var node = %return list.allocateNode(); |
| 183 | 183 | *node = Node { |
| 184 | 184 | .prev = null, |
std/list.zig deleted-91| ... | ... | @@ -1,91 +0,0 @@ |
| 1 | const debug = @import("debug.zig"); | |
| 2 | const assert = debug.assert; | |
| 3 | const mem = @import("mem.zig"); | |
| 4 | const Allocator = mem.Allocator; | |
| 5 | ||
| 6 | pub fn List(comptime T: type) -> type{ | |
| 7 | struct { | |
| 8 | const Self = this; | |
| 9 | ||
| 10 | /// Use toSlice instead of slicing this directly, because if you don't | |
| 11 | /// specify the end position of the slice, this will potentially give | |
| 12 | /// you uninitialized memory. | |
| 13 | items: []T, | |
| 14 | len: usize, | |
| 15 | allocator: &Allocator, | |
| 16 | ||
| 17 | pub fn init(allocator: &Allocator) -> Self { | |
| 18 | Self { | |
| 19 | .items = []T{}, | |
| 20 | .len = 0, | |
| 21 | .allocator = allocator, | |
| 22 | } | |
| 23 | } | |
| 24 | ||
| 25 | pub fn deinit(l: &Self) { | |
| 26 | l.allocator.free(l.items); | |
| 27 | } | |
| 28 | ||
| 29 | pub fn toSlice(l: &Self) -> []T { | |
| 30 | return l.items[0...l.len]; | |
| 31 | } | |
| 32 | ||
| 33 | pub fn toSliceConst(l: &const Self) -> []const T { | |
| 34 | return l.items[0...l.len]; | |
| 35 | } | |
| 36 | ||
| 37 | pub fn append(l: &Self, item: &const T) -> %void { | |
| 38 | const new_item_ptr = %return l.addOne(); | |
| 39 | *new_item_ptr = *item; | |
| 40 | } | |
| 41 | ||
| 42 | pub fn resize(l: &Self, new_len: usize) -> %void { | |
| 43 | %return l.ensureCapacity(new_len); | |
| 44 | l.len = new_len; | |
| 45 | } | |
| 46 | ||
| 47 | pub fn resizeDown(l: &Self, new_len: usize) { | |
| 48 | assert(new_len <= l.len); | |
| 49 | l.len = new_len; | |
| 50 | } | |
| 51 | ||
| 52 | pub fn ensureCapacity(l: &Self, new_capacity: usize) -> %void { | |
| 53 | var better_capacity = l.items.len; | |
| 54 | if (better_capacity >= new_capacity) return; | |
| 55 | while (true) { | |
| 56 | better_capacity += better_capacity / 2 + 8; | |
| 57 | if (better_capacity >= new_capacity) break; | |
| 58 | } | |
| 59 | l.items = %return l.allocator.realloc(T, l.items, better_capacity); | |
| 60 | } | |
| 61 | ||
| 62 | pub fn addOne(l: &Self) -> %&T { | |
| 63 | const new_length = l.len + 1; | |
| 64 | %return l.ensureCapacity(new_length); | |
| 65 | const result = &l.items[l.len]; | |
| 66 | l.len = new_length; | |
| 67 | return result; | |
| 68 | } | |
| 69 | ||
| 70 | pub fn pop(self: &Self) -> T { | |
| 71 | self.len -= 1; | |
| 72 | return self.items[self.len]; | |
| 73 | } | |
| 74 | } | |
| 75 | } | |
| 76 | ||
| 77 | test "basic list test" { | |
| 78 | var list = List(i32).init(&debug.global_allocator); | |
| 79 | defer list.deinit(); | |
| 80 | ||
| 81 | {var i: usize = 0; while (i < 10) : (i += 1) { | |
| 82 | %%list.append(i32(i + 1)); | |
| 83 | }} | |
| 84 | ||
| 85 | {var i: usize = 0; while (i < 10) : (i += 1) { | |
| 86 | assert(list.items[i] == i32(i + 1)); | |
| 87 | }} | |
| 88 | ||
| 89 | assert(list.pop() == 10); | |
| 90 | assert(list.len == 9); | |
| 91 | } |
std/os/index.zig+2-2| ... | ... | @@ -36,7 +36,7 @@ const cstr = @import("../cstr.zig"); |
| 36 | 36 | |
| 37 | 37 | const io = @import("../io.zig"); |
| 38 | 38 | const base64 = @import("../base64.zig"); |
| 39 | const List = @import("../list.zig").List; | |
| 39 | const ArrayList = @import("../array_list.zig").ArrayList; | |
| 40 | 40 | |
| 41 | 41 | error Unexpected; |
| 42 | 42 | error SystemResources; |
| ... | ... | @@ -683,7 +683,7 @@ start_over: |
| 683 | 683 | }; |
| 684 | 684 | defer dir.close(); |
| 685 | 685 | |
| 686 | var full_entry_buf = List(u8).init(allocator); | |
| 686 | var full_entry_buf = ArrayList(u8).init(allocator); | |
| 687 | 687 | defer full_entry_buf.deinit(); |
| 688 | 688 | |
| 689 | 689 | while (%return dir.next()) |entry| { |
std/special/build_runner.zig+2-2| ... | ... | @@ -5,7 +5,7 @@ const fmt = std.fmt; |
| 5 | 5 | const os = std.os; |
| 6 | 6 | const Builder = std.build.Builder; |
| 7 | 7 | const mem = std.mem; |
| 8 | const List = std.list.List; | |
| 8 | const ArrayList = std.ArrayList; | |
| 9 | 9 | |
| 10 | 10 | error InvalidArgs; |
| 11 | 11 | |
| ... | ... | @@ -51,7 +51,7 @@ pub fn main() -> %void { |
| 51 | 51 | var builder = Builder.init(allocator, zig_exe, build_root, cache_root); |
| 52 | 52 | defer builder.deinit(); |
| 53 | 53 | |
| 54 | var targets = List([]const u8).init(allocator); | |
| 54 | var targets = ArrayList([]const u8).init(allocator); | |
| 55 | 55 | |
| 56 | 56 | var prefix: ?[]const u8 = null; |
| 57 | 57 |
test/tests.zig+15-15| ... | ... | @@ -4,11 +4,11 @@ const build = std.build; |
| 4 | 4 | const os = std.os; |
| 5 | 5 | const StdIo = os.ChildProcess.StdIo; |
| 6 | 6 | const Term = os.ChildProcess.Term; |
| 7 | const Buffer = std.buffer.Buffer; | |
| 7 | const Buffer = std.Buffer; | |
| 8 | 8 | const io = std.io; |
| 9 | 9 | const mem = std.mem; |
| 10 | 10 | const fmt = std.fmt; |
| 11 | const List = std.list.List; | |
| 11 | const ArrayList = std.ArrayList; | |
| 12 | 12 | const Mode = @import("builtin").Mode; |
| 13 | 13 | |
| 14 | 14 | const compare_output = @import("compare_output.zig"); |
| ... | ... | @@ -138,7 +138,7 @@ pub const CompareOutputContext = struct { |
| 138 | 138 | |
| 139 | 139 | const TestCase = struct { |
| 140 | 140 | name: []const u8, |
| 141 | sources: List(SourceFile), | |
| 141 | sources: ArrayList(SourceFile), | |
| 142 | 142 | expected_output: []const u8, |
| 143 | 143 | link_libc: bool, |
| 144 | 144 | special: Special, |
| ... | ... | @@ -304,7 +304,7 @@ pub const CompareOutputContext = struct { |
| 304 | 304 | { |
| 305 | 305 | var tc = TestCase { |
| 306 | 306 | .name = name, |
| 307 | .sources = List(TestCase.SourceFile).init(self.b.allocator), | |
| 307 | .sources = ArrayList(TestCase.SourceFile).init(self.b.allocator), | |
| 308 | 308 | .expected_output = expected_output, |
| 309 | 309 | .link_libc = false, |
| 310 | 310 | .special = special, |
| ... | ... | @@ -432,8 +432,8 @@ pub const CompileErrorContext = struct { |
| 432 | 432 | |
| 433 | 433 | const TestCase = struct { |
| 434 | 434 | name: []const u8, |
| 435 | sources: List(SourceFile), | |
| 436 | expected_errors: List([]const u8), | |
| 435 | sources: ArrayList(SourceFile), | |
| 436 | expected_errors: ArrayList([]const u8), | |
| 437 | 437 | link_libc: bool, |
| 438 | 438 | is_exe: bool, |
| 439 | 439 | |
| ... | ... | @@ -486,7 +486,7 @@ pub const CompileErrorContext = struct { |
| 486 | 486 | const root_src = %%os.path.join(b.allocator, b.cache_root, self.case.sources.items[0].filename); |
| 487 | 487 | const obj_path = %%os.path.join(b.allocator, b.cache_root, "test.o"); |
| 488 | 488 | |
| 489 | var zig_args = List([]const u8).init(b.allocator); | |
| 489 | var zig_args = ArrayList([]const u8).init(b.allocator); | |
| 490 | 490 | %%zig_args.append(if (self.case.is_exe) "build_exe" else "build_obj"); |
| 491 | 491 | %%zig_args.append(b.pathFromRoot(root_src)); |
| 492 | 492 | |
| ... | ... | @@ -583,8 +583,8 @@ pub const CompileErrorContext = struct { |
| 583 | 583 | const tc = %%self.b.allocator.create(TestCase); |
| 584 | 584 | *tc = TestCase { |
| 585 | 585 | .name = name, |
| 586 | .sources = List(TestCase.SourceFile).init(self.b.allocator), | |
| 587 | .expected_errors = List([]const u8).init(self.b.allocator), | |
| 586 | .sources = ArrayList(TestCase.SourceFile).init(self.b.allocator), | |
| 587 | .expected_errors = ArrayList([]const u8).init(self.b.allocator), | |
| 588 | 588 | .link_libc = false, |
| 589 | 589 | .is_exe = false, |
| 590 | 590 | }; |
| ... | ... | @@ -660,7 +660,7 @@ pub const BuildExamplesContext = struct { |
| 660 | 660 | return; |
| 661 | 661 | } |
| 662 | 662 | |
| 663 | var zig_args = List([]const u8).init(b.allocator); | |
| 663 | var zig_args = ArrayList([]const u8).init(b.allocator); | |
| 664 | 664 | %%zig_args.append("build"); |
| 665 | 665 | |
| 666 | 666 | %%zig_args.append("--build-file"); |
| ... | ... | @@ -713,8 +713,8 @@ pub const ParseHContext = struct { |
| 713 | 713 | |
| 714 | 714 | const TestCase = struct { |
| 715 | 715 | name: []const u8, |
| 716 | sources: List(SourceFile), | |
| 717 | expected_lines: List([]const u8), | |
| 716 | sources: ArrayList(SourceFile), | |
| 717 | expected_lines: ArrayList([]const u8), | |
| 718 | 718 | allow_warnings: bool, |
| 719 | 719 | |
| 720 | 720 | const SourceFile = struct { |
| ... | ... | @@ -761,7 +761,7 @@ pub const ParseHContext = struct { |
| 761 | 761 | |
| 762 | 762 | const root_src = %%os.path.join(b.allocator, b.cache_root, self.case.sources.items[0].filename); |
| 763 | 763 | |
| 764 | var zig_args = List([]const u8).init(b.allocator); | |
| 764 | var zig_args = ArrayList([]const u8).init(b.allocator); | |
| 765 | 765 | %%zig_args.append("parseh"); |
| 766 | 766 | %%zig_args.append(b.pathFromRoot(root_src)); |
| 767 | 767 | |
| ... | ... | @@ -847,8 +847,8 @@ pub const ParseHContext = struct { |
| 847 | 847 | const tc = %%self.b.allocator.create(TestCase); |
| 848 | 848 | *tc = TestCase { |
| 849 | 849 | .name = name, |
| 850 | .sources = List(TestCase.SourceFile).init(self.b.allocator), | |
| 851 | .expected_lines = List([]const u8).init(self.b.allocator), | |
| 850 | .sources = ArrayList(TestCase.SourceFile).init(self.b.allocator), | |
| 851 | .expected_lines = ArrayList([]const u8).init(self.b.allocator), | |
| 852 | 852 | .allow_warnings = allow_warnings, |
| 853 | 853 | }; |
| 854 | 854 | tc.addSourceFile("source.h", source); |