From 3d99fb3352eca9da68b6033ad22a166ed68ed36a Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Mon, 17 May 2021 15:29:59 -0700 Subject: stage2: get rid of DeclRef --- BRANCH_TODO | 1 - src/Module.zig | 16 ---------------- 2 files changed, 17 deletions(-) diff --git a/BRANCH_TODO b/BRANCH_TODO index f1981b6236..e9d2e26a9f 100644 --- a/BRANCH_TODO +++ b/BRANCH_TODO @@ -3,7 +3,6 @@ their indexes starting at 0 so that we can use an array to store Sema results rather than a map. - * get rid of Scope.DeclRef * get rid of NameHash * handle decl collision with usingnamespace * the decl doing the looking up needs to create a decl dependency diff --git a/src/Module.zig b/src/Module.zig index 6dc0b2a256..afa29d65fd 100644 --- a/src/Module.zig +++ b/src/Module.zig @@ -812,7 +812,6 @@ pub const Scope = struct { .block => scope.cast(Block).?.sema.owner_decl, .file => null, .namespace => null, - .decl_ref => scope.cast(DeclRef).?.decl, }; } @@ -821,7 +820,6 @@ pub const Scope = struct { .block => scope.cast(Block).?.src_decl, .file => null, .namespace => scope.cast(Namespace).?.getDecl(), - .decl_ref => scope.cast(DeclRef).?.decl, }; } @@ -831,7 +829,6 @@ pub const Scope = struct { .block => return scope.cast(Block).?.sema.owner_decl.namespace, .file => return scope.cast(File).?.root_decl.?.namespace, .namespace => return scope.cast(Namespace).?, - .decl_ref => return scope.cast(DeclRef).?.decl.namespace, } } @@ -854,7 +851,6 @@ pub const Scope = struct { .namespace => return @fieldParentPtr(Namespace, "base", cur).file_scope, .file => return @fieldParentPtr(File, "base", cur), .block => return @fieldParentPtr(Block, "base", cur).src_decl.namespace.file_scope, - .decl_ref => return @fieldParentPtr(DeclRef, "base", cur).decl.namespace.file_scope, }; } } @@ -1403,12 +1399,6 @@ pub const Scope = struct { return &inst.base; } }; - - pub const DeclRef = struct { - pub const base_tag: Tag = .decl_ref; - base: Scope = Scope{ .tag = base_tag }, - decl: *Decl, - }; }; /// 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 }, .file => unreachable, .namespace => unreachable, - .decl_ref => { - const decl_ref = scope.cast(Scope.DeclRef).?; - decl_ref.decl.analysis = .sema_failure; - decl_ref.decl.generation = mod.generation; - mod.failed_decls.putAssumeCapacityNoClobber(decl_ref.decl, err_msg); - }, } return error.AnalysisFail; } -- cgit v1.2.3