authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2021-05-17 15:29:59-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2021-05-17 16:09:20-07:00
log3d99fb3352eca9da68b6033ad22a166ed68ed36a
tree3d9a3be8f28f178ea43416d611c1604c0f8cfdb9
parentd5e894a9a7c63ebbfaa3c4eb6d173e15745ad39c

stage2: get rid of DeclRef


2 files changed, 0 insertions(+), 17 deletions(-)

BRANCH_TODO-1
......@@ -3,7 +3,6 @@
33 their indexes starting at 0 so that we can use an array to store Sema
44 results rather than a map.
55
6 * get rid of Scope.DeclRef
76 * get rid of NameHash
87 * handle decl collision with usingnamespace
98 * the decl doing the looking up needs to create a decl dependency
src/Module.zig-16
......@@ -812,7 +812,6 @@ pub const Scope = struct {
812812 .block => scope.cast(Block).?.sema.owner_decl,
813813 .file => null,
814814 .namespace => null,
815 .decl_ref => scope.cast(DeclRef).?.decl,
816815 };
817816 }
818817
......@@ -821,7 +820,6 @@ pub const Scope = struct {
821820 .block => scope.cast(Block).?.src_decl,
822821 .file => null,
823822 .namespace => scope.cast(Namespace).?.getDecl(),
824 .decl_ref => scope.cast(DeclRef).?.decl,
825823 };
826824 }
827825
......@@ -831,7 +829,6 @@ pub const Scope = struct {
831829 .block => return scope.cast(Block).?.sema.owner_decl.namespace,
832830 .file => return scope.cast(File).?.root_decl.?.namespace,
833831 .namespace => return scope.cast(Namespace).?,
834 .decl_ref => return scope.cast(DeclRef).?.decl.namespace,
835832 }
836833 }
837834
......@@ -854,7 +851,6 @@ pub const Scope = struct {
854851 .namespace => return @fieldParentPtr(Namespace, "base", cur).file_scope,
855852 .file => return @fieldParentPtr(File, "base", cur),
856853 .block => return @fieldParentPtr(Block, "base", cur).src_decl.namespace.file_scope,
857 .decl_ref => return @fieldParentPtr(DeclRef, "base", cur).decl.namespace.file_scope,
858854 };
859855 }
860856 }
......@@ -1403,12 +1399,6 @@ pub const Scope = struct {
14031399 return &inst.base;
14041400 }
14051401 };
1406
1407 pub const DeclRef = struct {
1408 pub const base_tag: Tag = .decl_ref;
1409 base: Scope = Scope{ .tag = base_tag },
1410 decl: *Decl,
1411 };
14121402};
14131403
14141404/// This struct holds data necessary to construct API-facing `AllErrors.Message`.
......@@ -4012,12 +4002,6 @@ pub fn failWithOwnedErrorMsg(mod: *Module, scope: *Scope, err_msg: *ErrorMsg) In
40124002 },
40134003 .file => unreachable,
40144004 .namespace => unreachable,
4015 .decl_ref => {
4016 const decl_ref = scope.cast(Scope.DeclRef).?;
4017 decl_ref.decl.analysis = .sema_failure;
4018 decl_ref.decl.generation = mod.generation;
4019 mod.failed_decls.putAssumeCapacityNoClobber(decl_ref.decl, err_msg);
4020 },
40214005 }
40224006 return error.AnalysisFail;
40234007}