stage2: get rid of NameHash

Previously, stage2 used a global decl_table for all Decl objects, keyed
by a 16-byte name hash that was hopefully unique. Now, there is a tree
of Namespace objects that own their named Decl objects.
This commit is contained in:
Andrew Kelley
2021-05-17 15:35:24 -07:00
parent 3d99fb3352
commit 731c35f15a
6 changed files with 0 additions and 49 deletions

View File

@@ -798,8 +798,6 @@ pub const Var = struct {
pub const Scope = struct {
tag: Tag,
pub const NameHash = [16]u8;
pub fn cast(base: *Scope, comptime T: type) ?*T {
if (base.tag != T.base_tag)
return null;
@@ -839,7 +837,6 @@ pub const Scope = struct {
.namespace => return @fieldParentPtr(Namespace, "base", base).file_scope.sub_file_path,
.file => return @fieldParentPtr(File, "base", base).sub_file_path,
.block => unreachable,
.decl_ref => unreachable,
}
}
@@ -861,10 +858,6 @@ pub const Scope = struct {
/// Namespace owned by structs, enums, unions, and opaques for decls.
namespace,
block,
/// Used for simple error reporting. Only contains a reference to a
/// `Decl` for use with `srcDecl` and `ownerDecl`.
/// Has no parents or children.
decl_ref,
};
/// The container that structs, enums, unions, and opaques have.