Sema: improve auto generated union enum name

This commit is contained in:
Veikka Tuominen
2022-06-28 17:15:10 +03:00
committed by Jakub Konka
parent 2e7dc5e151
commit 6cadac18b8
3 changed files with 50 additions and 15 deletions

View File

@@ -503,6 +503,8 @@ pub const Decl = struct {
alive: bool,
/// Whether the Decl is a `usingnamespace` declaration.
is_usingnamespace: bool,
/// If true `name` is already fully qualified.
name_fully_qualified: bool = false,
/// Represents the position of the code in the output file.
/// This is populated regardless of semantic analysis and code generation.
@@ -686,6 +688,9 @@ pub const Decl = struct {
pub fn renderFullyQualifiedName(decl: Decl, mod: *Module, writer: anytype) !void {
const unqualified_name = mem.sliceTo(decl.name, 0);
if (decl.name_fully_qualified) {
return writer.writeAll(unqualified_name);
}
return decl.src_namespace.renderFullyQualifiedName(mod, unqualified_name, writer);
}