analysis/low-level-api-fir/README.md
Low-level API FIR (LL API or LL FIR for short) is an interlayer between Analysis API FIR Implementation and FIR compiler. Low-level API FIR is responsible but not limited for:
KtElementYou can read about how FIR compiler works here.
The entry point for LL API is LLResolutionFacade.
LLResolutionFacade represents a project view from a use-site KaModule.
The lifetime of LLResolutionFacade is limited by modification events.
LowLevelFirApiFacade file contains a useful API surface to interact with Low Level API FIR from Analysis API FIR.
There are a bunch of different areas. Docs for each area are sorted by context depth – from the basic overview to the deepest implementation details.
KtElement to FirElement (KT → FIR) & Incremental Analysis & Collecting diagnostics
KtElement to FirElement.FileStructureElement which is associated with some KtFile.
Aggregates information about KT → FIR mapping and diagnostics for an associated file.KtElement.
Is responsible for KT → FIR mapping and diagnostics for the specific KtElement.FileStructureElement.FileStructure invalidation in the case of associated PSI modification.FirElementWithResolveState element and a desired phase and resolve this element to this phase.LLFirResolveTarget for the specific FirElementWithResolveState.
Decides which element can be resolved lazily and which cannot.FirElementWithResolveState.LLFirTargetResolver for each compiler phase,
each of which is responsible for all the resolution logic for the associated phase.LLFirTargetResolver during resolution.The LLResolutionFacade represents a view from a specific module (root module) to the dependent modules. A module is represented by:
LLFirSession – the implementation of FirSession (FIR compiler representation of a module)ModuleFileCache – the KtFile -> FirFile cache & also caches for FIR providers