compiler-plugin / arrow.meta.dsl.analysis / AnalysisSyntax

AnalysisSyntax

interface AnalysisSyntax

The Analysis phase determines if the parsed AST type checks and resolves properly. As part of this phase, we have access to events happening before and after resolution. Before resolution, we are given the chance to modify the compiler trees in the form of KtElement via the Quote Template System.

Functions

additionalSources additionalSources is a function that is invoked before resolution and allows us to provide an additional set of KtFile files. These files will be considered part of the compilation unit alongside the user sources.open fun additionalSources(collectAdditionalSourcesAndUpdateConfiguration: CompilerContext.(knownSources: Collection<KtFile>, configuration: CompilerConfiguration, project: Project) -> Collection<KtFile>): CollectAdditionalSources
analysis The analysis function allows us to intercept analysis before and after it happens, altering the analysis inputs and outputs. Altering the inputs on @doAnalysis allows us to modify the compiler trees in the AST before they are considered for resolution. This allows us to build the Quote in this phase, which is Arrow Meta’s higher level API. Altering the output with analysisCompleted allows us to modify the binding trace and all elements resulting from analysis.open fun analysis(doAnalysis: CompilerContext.(project: Project, module: ModuleDescriptor, projectContext: ProjectContext, files: Collection<KtFile>, bindingTrace: BindingTrace, componentProvider: ComponentProvider) -> AnalysisResult?, analysisCompleted: CompilerContext.(project: Project, module: ModuleDescriptor, bindingTrace: BindingTrace, files: Collection<KtFile>) -> AnalysisResult? = Noop.nullable5()): AnalysisHandler
extraImports The extraImports function allows the user to provide an additional set of org.jetbrains.kotlin.psi.KtImportInfo imports for each individual KtFile considered as sources. This additional set of imports are taken into account when resolving symbols in the resolution phase of a KtFile.open fun extraImports(extraImports: CompilerContext.(ktFile: KtFile) -> Collection<KtImportInfo>): ExtraImports
preprocessedVirtualFileFactory open fun preprocessedVirtualFileFactory(createPreprocessedFile: CompilerContext.(file: VirtualFile?) -> VirtualFile?, createPreprocessedLightFile: CompilerContext.(file: LightVirtualFile?) -> LightVirtualFile? = Noop.nullable2()): PreprocessedVirtualFileFactory
suppressDiagnostic The suppressDiagnostic function allows selectively determining whether a diagnostic emitted by the compiler affects compilation. As the compiler performs resolution, it will generate diagnostic of type Diagnostic with different Severity levels: Severity.INFO, Severity.ERROR, and Severity.WARNING. When the suppressDiagnostic returns true, the emitted diagnostic is suppressed and removed from the BindingTrace. This will cause the Diagnostic to not be considered in further compilation phases.open fun suppressDiagnostic(f: (Diagnostic) -> Boolean): ExtensionPhase
suppressDiagnosticWithTrace open fun suppressDiagnosticWithTrace(f: BindingTrace.(Diagnostic) -> Boolean): ExtensionPhase

Inheritors

MetaPluginSyntax interface MetaPluginSyntax : ConfigSyntax, AnalysisSyntax, ResolveSyntax, CodegenSyntax

Do you like Arrow?

Arrow Org
<