Add AnalysisHandlerExtension extension point for K2JsCompiler

AnalysisHandlerExtension allows compiler plugins to:
1. Intercept and override the default analysis.
2. Utilize the compiler infrastructure to do custom analysis.

A well know plugin on the JVM platform is KAPT.
This commit is contained in:
Ting-Yuan Huang
2021-03-12 23:00:09 -08:00
committed by TeamCityServer
parent 4db79285c1
commit 8e7b561b10
6 changed files with 100 additions and 25 deletions
@@ -48,7 +48,7 @@ class JsVersionRequirementTest : AbstractVersionRequirementTest() {
}
val trace = BindingTraceContext()
val analysisResult = TopDownAnalyzerFacadeForJS.analyzeFilesWithGivenTrace(
ktFiles, trace, createModule(environment), environment.configuration, CompilerEnvironment,
ktFiles, trace, createModule(environment), environment.configuration, CompilerEnvironment, environment.project
)
// There are INVISIBLE_REFERENCE errors on RequireKotlin and K2JSTranslator refuses to translate the code otherwise
@@ -63,7 +63,7 @@ class JsVersionRequirementTest : AbstractVersionRequirementTest() {
override fun loadModule(directory: File): ModuleDescriptor {
val environment = createEnvironment(extraDependencies = listOf(File(directory, "lib.meta.js")))
return TopDownAnalyzerFacadeForJS.analyzeFilesWithGivenTrace(
emptyList(), BindingTraceContext(), createModule(environment), environment.configuration, CompilerEnvironment,
emptyList(), BindingTraceContext(), createModule(environment), environment.configuration, CompilerEnvironment, environment.project
).moduleDescriptor
}