mirror of
https://github.com/ziglang/zig.git
synced 2026-01-21 06:45:24 +00:00
try allocation of pointer type when parsing (#5665)
* `try` allocation of pointer type when parsing * fixes pointer destroy compile error
This commit is contained in:
parent
d907f574e0
commit
65ef74e2cd
@ -1535,7 +1535,7 @@ fn parseInternal(comptime T: type, token: Token, tokens: *TokenStream, options:
|
||||
const allocator = options.allocator orelse return error.AllocatorRequired;
|
||||
switch (ptrInfo.size) {
|
||||
.One => {
|
||||
const r: T = allocator.create(ptrInfo.child);
|
||||
const r: T = try allocator.create(ptrInfo.child);
|
||||
r.* = try parseInternal(ptrInfo.child, token, tokens, options);
|
||||
return r;
|
||||
},
|
||||
@ -1629,7 +1629,7 @@ pub fn parseFree(comptime T: type, value: T, options: ParseOptions) void {
|
||||
switch (ptrInfo.size) {
|
||||
.One => {
|
||||
parseFree(ptrInfo.child, value.*, options);
|
||||
allocator.destroy(v);
|
||||
allocator.destroy(value);
|
||||
},
|
||||
.Slice => {
|
||||
for (value) |v| {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user