pub struct TypeCache {
pub symbol_types: FxHashMap<SymbolId, TypeId>,
pub symbol_instance_types: FxHashMap<SymbolId, TypeId>,
pub node_types: FxHashMap<u32, TypeId>,
pub symbol_dependencies: FxHashMap<SymbolId, FxHashSet<SymbolId>>,
pub def_to_symbol: FxHashMap<DefId, SymbolId>,
pub flow_analysis_cache: FxHashMap<(FlowNodeId, SymbolId, TypeId), TypeId>,
pub class_instance_type_to_decl: FxHashMap<TypeId, NodeIndex>,
pub class_instance_type_cache: FxHashMap<NodeIndex, TypeId>,
pub class_constructor_type_cache: FxHashMap<NodeIndex, TypeId>,
pub type_only_nodes: FxHashSet<NodeIndex>,
}Expand description
Persistent cache for type checking results across LSP queries. This cache survives between LSP requests but is invalidated when the file changes.
Fields§
§symbol_types: FxHashMap<SymbolId, TypeId>Cached types for symbols.
symbol_instance_types: FxHashMap<SymbolId, TypeId>Cached instance types for class symbols (for TYPE position).
Distinguishes from symbol_types which holds constructor types for VALUE position.
node_types: FxHashMap<u32, TypeId>Cached types for nodes.
symbol_dependencies: FxHashMap<SymbolId, FxHashSet<SymbolId>>Symbol dependency graph (symbol -> referenced symbols).
def_to_symbol: FxHashMap<DefId, SymbolId>Maps DefIds to SymbolIds for declaration emit usage analysis.
Populated by CheckerContext during type checking, consumed by UsageAnalyzer.
flow_analysis_cache: FxHashMap<(FlowNodeId, SymbolId, TypeId), TypeId>Cache for control flow analysis results.
Key: (FlowNodeId, SymbolId, InitialTypeId) -> NarrowedTypeId
class_instance_type_to_decl: FxHashMap<TypeId, NodeIndex>Maps class instance TypeIds to their class declaration NodeIndex.
Used by get_class_decl_from_type to correctly identify the class
for derived classes that have no private/protected members.
class_instance_type_cache: FxHashMap<NodeIndex, TypeId>Forward cache: class declaration NodeIndex -> computed instance TypeId.
Avoids recomputing the full class instance type on every member check.
class_constructor_type_cache: FxHashMap<NodeIndex, TypeId>Forward cache: class declaration NodeIndex -> computed constructor TypeId.
Avoids recomputing constructor shape/inheritance on repeated class queries.
type_only_nodes: FxHashSet<NodeIndex>Set of import specifier nodes that should be elided from JavaScript output. These are imports that reference type-only declarations (interfaces, type aliases).