aboutsummaryrefslogtreecommitdiff
path: root/src/Package.zig
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2021-05-17 15:35:24 -0700
committerAndrew Kelley <andrew@ziglang.org>2021-05-17 16:09:20 -0700
commit731c35f15a1469c9523b71476f1e069d5bcfd979 (patch)
tree00b0244c86df035ff721cb45216594426007ce96 /src/Package.zig
parent3d99fb3352eca9da68b6033ad22a166ed68ed36a (diff)
downloadzig-731c35f15a1469c9523b71476f1e069d5bcfd979.tar.gz
zig-731c35f15a1469c9523b71476f1e069d5bcfd979.zip
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.
Diffstat (limited to 'src/Package.zig')
-rw-r--r--src/Package.zig11
1 files changed, 0 insertions, 11 deletions
diff --git a/src/Package.zig b/src/Package.zig
index 25a9f55d63..5fec4be3d2 100644
--- a/src/Package.zig
+++ b/src/Package.zig
@@ -11,22 +11,15 @@ const Module = @import("Module.zig");
pub const Table = std.StringHashMapUnmanaged(*Package);
-pub const root_namespace_hash: Module.Scope.NameHash = .{
- 0, 0, 6, 6, 6, 0, 0, 0,
- 6, 9, 0, 0, 0, 4, 2, 0,
-};
-
root_src_directory: Compilation.Directory,
/// Relative to `root_src_directory`. May contain path separators.
root_src_path: []const u8,
table: Table = .{},
parent: ?*Package = null,
-namespace_hash: Module.Scope.NameHash,
/// Whether to free `root_src_directory` on `destroy`.
root_src_directory_owned: bool = false,
/// Allocate a Package. No references to the slices passed are kept.
-/// Don't forget to set `namespace_hash` later.
pub fn create(
gpa: *Allocator,
/// Null indicates the current working directory
@@ -50,7 +43,6 @@ pub fn create(
},
.root_src_path = owned_src_path,
.root_src_directory_owned = true,
- .namespace_hash = undefined,
};
return ptr;
@@ -82,14 +74,12 @@ pub fn createWithDir(
},
.root_src_directory_owned = true,
.root_src_path = owned_src_path,
- .namespace_hash = undefined,
};
} else {
ptr.* = .{
.root_src_directory = directory,
.root_src_directory_owned = false,
.root_src_path = owned_src_path,
- .namespace_hash = undefined,
};
}
return ptr;
@@ -129,6 +119,5 @@ pub fn add(pkg: *Package, gpa: *Allocator, name: []const u8, package: *Package)
pub fn addAndAdopt(parent: *Package, gpa: *Allocator, name: []const u8, child: *Package) !void {
assert(child.parent == null); // make up your mind, who is the parent??
child.parent = parent;
- child.namespace_hash = std.zig.hashName(parent.namespace_hash, ":", name);
return parent.add(gpa, name, child);
}