| ... | ... | @@ -617,15 +617,17 @@ pub const Decl = struct { |
| 617 | 617 | return tree.tokens.items(.start)[decl.srcToken()]; |
| 618 | 618 | } |
| 619 | 619 | |
| 620 | | pub fn renderFullyQualifiedName(decl: *const Decl, writer: anytype) @TypeOf(writer).Error!void { |
| 621 | | return try decl.src_namespace.renderFullyQualifiedName(mem.spanZ(decl.name), writer); |
| 620 | pub fn renderFullyQualifiedName(decl: Decl, writer: anytype) !void { |
| 621 | const unqualified_name = mem.spanZ(decl.name); |
| 622 | return decl.src_namespace.renderFullyQualifiedName(unqualified_name, writer); |
| 622 | 623 | } |
| 623 | 624 | |
| 624 | | pub fn renderFullyQualifiedDebugName(decl: *const Decl, writer: anytype) @TypeOf(writer).Error!void { |
| 625 | | return try decl.src_namespace.renderFullyQualifiedDebugName(mem.spanZ(decl.name), writer); |
| 625 | pub fn renderFullyQualifiedDebugName(decl: Decl, writer: anytype) !void { |
| 626 | const unqualified_name = mem.spanZ(decl.name); |
| 627 | return decl.src_namespace.renderFullyQualifiedDebugName(unqualified_name, writer); |
| 626 | 628 | } |
| 627 | 629 | |
| 628 | | pub fn getFullyQualifiedName(decl: *const Decl, gpa: *Allocator) ![:0]u8 { |
| 630 | pub fn getFullyQualifiedName(decl: Decl, gpa: *Allocator) ![:0]u8 { |
| 629 | 631 | var buffer = std.ArrayList(u8).init(gpa); |
| 630 | 632 | defer buffer.deinit(); |
| 631 | 633 | try decl.renderFullyQualifiedName(buffer.writer()); |
| ... | ... | @@ -1246,7 +1248,7 @@ pub const Scope = struct { |
| 1246 | 1248 | } |
| 1247 | 1249 | } |
| 1248 | 1250 | |
| 1249 | | // This renders e.g. "std.fs:Dir.OpenOptions" |
| 1251 | /// This renders e.g. "std/fs.zig:Dir.OpenOptions" |
| 1250 | 1252 | pub fn renderFullyQualifiedDebugName( |
| 1251 | 1253 | ns: Namespace, |
| 1252 | 1254 | name: []const u8, |
| ... | ... | @@ -4055,16 +4057,17 @@ pub fn deleteUnusedDecl(mod: *Module, decl: *Decl) void { |
| 4055 | 4057 | decl.destroy(mod); |
| 4056 | 4058 | } |
| 4057 | 4059 | |
| 4060 | /// Cancel the creation of an anon decl and delete any references to it. |
| 4061 | /// If other decls depend on this decl, they must be aborted first. |
| 4058 | 4062 | pub fn abortAnonDecl(mod: *Module, decl: *Decl) void { |
| 4059 | 4063 | log.debug("abortAnonDecl {*} ({s})", .{ decl, decl.name }); |
| 4060 | 4064 | |
| 4061 | 4065 | assert(!decl.isRoot()); |
| 4062 | 4066 | assert(decl.src_namespace.anon_decls.swapRemove(decl)); |
| 4063 | 4067 | |
| 4064 | | const dependants = decl.dependants.keys(); |
| 4065 | | for (dependants) |dep| { |
| 4066 | | dep.removeDependency(decl); |
| 4067 | | } |
| 4068 | // An aborted decl must not have dependants -- they must have |
| 4069 | // been aborted first and removed from this list. |
| 4070 | assert(decl.dependants.count() == 0); |
| 4068 | 4071 | |
| 4069 | 4072 | for (decl.dependencies.keys()) |dep| { |
| 4070 | 4073 | dep.removeDependant(decl); |