diff options
author | Jonas Schievink <[email protected]> | 2021-03-05 13:15:26 +0000 |
---|---|---|
committer | Jonas Schievink <[email protected]> | 2021-03-09 17:27:23 +0000 |
commit | 0cb46a9e8d20a5f843e3a7fa6387779d1ff68c3b (patch) | |
tree | 60c43482d4f3d71d12cec7a8f9412ef7676c4b79 /crates | |
parent | c12f7be8d33f9ddfd69f72fb75acc5b12d149527 (diff) |
Use `body.block_scopes` to validate inner items
Diffstat (limited to 'crates')
-rw-r--r-- | crates/hir_ty/src/diagnostics/decl_check.rs | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/crates/hir_ty/src/diagnostics/decl_check.rs b/crates/hir_ty/src/diagnostics/decl_check.rs index e230f9765..3605ca581 100644 --- a/crates/hir_ty/src/diagnostics/decl_check.rs +++ b/crates/hir_ty/src/diagnostics/decl_check.rs | |||
@@ -99,9 +99,14 @@ impl<'a, 'b> DeclValidator<'a, 'b> { | |||
99 | let body = self.db.body(func.into()); | 99 | let body = self.db.body(func.into()); |
100 | 100 | ||
101 | // Recursively validate inner scope items, such as static variables and constants. | 101 | // Recursively validate inner scope items, such as static variables and constants. |
102 | for (item_id, _) in body.item_scope.values() { | 102 | let db = self.db; |
103 | let mut validator = DeclValidator::new(self.db, self.krate, self.sink); | 103 | for block_def_map in body.block_scopes.iter().filter_map(|block| db.block_def_map(*block)) { |
104 | validator.validate_item(item_id); | 104 | for (_, module) in block_def_map.modules() { |
105 | for (def_id, _) in module.scope.values() { | ||
106 | let mut validator = DeclValidator::new(self.db, self.krate, self.sink); | ||
107 | validator.validate_item(def_id); | ||
108 | } | ||
109 | } | ||
105 | } | 110 | } |
106 | 111 | ||
107 | // Check whether non-snake case identifiers are allowed for this function. | 112 | // Check whether non-snake case identifiers are allowed for this function. |