self-hosted: fix compile errors, except for codegen.zig

This commit is contained in:
Andrew Kelley
2020-05-13 20:06:01 -04:00
parent a3da584248
commit 080022f6c6
8 changed files with 525 additions and 264 deletions

View File

@@ -269,13 +269,6 @@ pub fn ArrayListAligned(comptime T: type, comptime alignment: ?u29) type {
/// Bring-your-own allocator with every function call.
/// Initialize directly and deinitialize with `deinit` or use `toOwnedSlice`.
pub fn init() Self {
return .{
.items = &[_]T{},
.capacity = 0,
};
}
pub fn ArrayListUnmanaged(comptime T: type) type {
return ArrayListAlignedUnmanaged(T, null);
}
@@ -317,7 +310,7 @@ pub fn ArrayListAlignedUnmanaged(comptime T: type, comptime alignment: ?u29) typ
/// The caller owns the returned memory. ArrayList becomes empty.
pub fn toOwnedSlice(self: *Self, allocator: *Allocator) Slice {
const result = allocator.shrink(self.allocatedSlice(), self.items.len);
self.* = init(allocator);
self.* = Self{};
return result;
}