Apply AST fixes

This commit is contained in:
Jakub Konka 2021-06-24 23:08:24 +02:00
parent 8fc5b5a087
commit 264f5f4544
2 changed files with 2 additions and 15 deletions

View File

@ -73,8 +73,6 @@ pub const Regular = struct {
global,
};
pub fn deinit(regular: *Regular, allocator: *Allocator) void {}
pub fn isTemp(regular: *Regular) bool {
if (regular.linkage == .translation_unit) {
return mem.startsWith(u8, regular.base.name, "l") or mem.startsWith(u8, regular.base.name, "L");
@ -116,8 +114,6 @@ pub const Unresolved = struct {
file: *Object,
pub const base_type: Symbol.Type = .unresolved;
pub fn deinit(unresolved: *Unresolved, allocator: *Allocator) void {}
};
pub const Tentative = struct {
@ -133,17 +129,13 @@ pub const Tentative = struct {
file: *Object,
pub const base_type: Symbol.Type = .tentative;
pub fn deinit(tentative: *Tentative, allocator: *Allocator) void {}
};
pub fn deinit(base: *Symbol, allocator: *Allocator) void {
allocator.free(base.name);
switch (base.@"type") {
.regular => @fieldParentPtr(Regular, "base", base).deinit(allocator),
.proxy => @fieldParentPtr(Proxy, "base", base).deinit(allocator),
.unresolved => @fieldParentPtr(Unresolved, "base", base).deinit(allocator),
.tentative => @fieldParentPtr(Tentative, "base", base).deinit(allocator),
else => {},
}
}

View File

@ -42,7 +42,7 @@ pub const Node = struct {
.doc => @fieldParentPtr(Node.Doc, "base", self).deinit(allocator),
.map => @fieldParentPtr(Node.Map, "base", self).deinit(allocator),
.list => @fieldParentPtr(Node.List, "base", self).deinit(allocator),
.value => @fieldParentPtr(Node.Value, "base", self).deinit(allocator),
.value => {},
}
}
@ -180,11 +180,6 @@ pub const Node = struct {
pub const base_tag: Node.Tag = .value;
pub fn deinit(self: *Value, allocator: *Allocator) void {
_ = self;
_ = allocator;
}
pub fn format(
self: *const Value,
comptime fmt: []const u8,