@@ -12,11 +12,11 @@ use crate::db::{LintDb, LintJar, QueryResult};
1212use crate :: files:: FileId ;
1313use crate :: module:: { resolve_module, ModuleName } ;
1414use crate :: parse:: parse;
15- use crate :: source :: { source_text , Source } ;
16- use crate :: symbols :: {
17- resolve_global_symbol, symbol_table , Definition , GlobalSymbolId , SymbolId , SymbolTable ,
15+ use crate :: semantic :: { infer_definition_type , infer_symbol_public_type , Type } ;
16+ use crate :: semantic :: {
17+ resolve_global_symbol, semantic_index , Definition , GlobalSymbolId , SemanticIndex , SymbolId ,
1818} ;
19- use crate :: types :: { infer_definition_type , infer_symbol_public_type , Type } ;
19+ use crate :: source :: { source_text , Source } ;
2020
2121#[ tracing:: instrument( level = "debug" , skip( db) ) ]
2222pub ( crate ) fn lint_syntax ( db : & dyn LintDb , file_id : FileId ) -> QueryResult < Diagnostics > {
@@ -82,13 +82,13 @@ pub(crate) fn lint_semantic(db: &dyn LintDb, file_id: FileId) -> QueryResult<Dia
8282 storage. get ( & file_id, |file_id| {
8383 let source = source_text ( db. upcast ( ) , * file_id) ?;
8484 let parsed = parse ( db. upcast ( ) , * file_id) ?;
85- let symbols = symbol_table ( db. upcast ( ) , * file_id) ?;
85+ let semantic_index = semantic_index ( db. upcast ( ) , * file_id) ?;
8686
8787 let context = SemanticLintContext {
8888 file_id : * file_id,
8989 source,
9090 parsed : & parsed,
91- symbols ,
91+ semantic_index ,
9292 db,
9393 diagnostics : RefCell :: new ( Vec :: new ( ) ) ,
9494 } ;
@@ -102,7 +102,7 @@ pub(crate) fn lint_semantic(db: &dyn LintDb, file_id: FileId) -> QueryResult<Dia
102102
103103fn lint_unresolved_imports ( context : & SemanticLintContext ) -> QueryResult < ( ) > {
104104 // TODO: Consider iterating over the dependencies (imports) only instead of all definitions.
105- for ( symbol, definition) in context. symbols ( ) . all_definitions ( ) {
105+ for ( symbol, definition) in context. semantic_index ( ) . symbol_table ( ) . all_definitions ( ) {
106106 match definition {
107107 Definition :: Import ( import) => {
108108 let ty = context. infer_symbol_public_type ( symbol) ?;
@@ -152,7 +152,7 @@ fn lint_bad_overrides(context: &SemanticLintContext) -> QueryResult<()> {
152152
153153 // TODO we should maybe index definitions by type instead of iterating all, or else iterate all
154154 // just once, match, and branch to all lint rules that care about a type of definition
155- for ( symbol, definition) in context. symbols ( ) . all_definitions ( ) {
155+ for ( symbol, definition) in context. semantic_index ( ) . symbol_table ( ) . all_definitions ( ) {
156156 if !matches ! ( definition, Definition :: FunctionDef ( _) ) {
157157 continue ;
158158 }
@@ -194,7 +194,7 @@ pub struct SemanticLintContext<'a> {
194194 file_id : FileId ,
195195 source : Source ,
196196 parsed : & ' a Parsed < ModModule > ,
197- symbols : Arc < SymbolTable > ,
197+ semantic_index : Arc < SemanticIndex > ,
198198 db : & ' a dyn LintDb ,
199199 diagnostics : RefCell < Vec < String > > ,
200200}
@@ -212,8 +212,8 @@ impl<'a> SemanticLintContext<'a> {
212212 self . parsed . syntax ( )
213213 }
214214
215- pub fn symbols ( & self ) -> & SymbolTable {
216- & self . symbols
215+ pub fn semantic_index ( & self ) -> & SemanticIndex {
216+ & self . semantic_index
217217 }
218218
219219 pub fn infer_symbol_public_type ( & self , symbol_id : SymbolId ) -> QueryResult < Type > {
0 commit comments