IR: introduce StubGeneratorExtensions for ExternalDependenciesGenerator
This is a refactoring to simplify the API of ExternalDependenciesGenerator and to constrain future additions of platform-specific stub generator extensions.
This commit is contained in:
@@ -6,7 +6,6 @@
|
||||
package org.jetbrains.kotlin.ir.backend.js
|
||||
|
||||
import com.intellij.openapi.project.Project
|
||||
import org.jetbrains.kotlin.library.resolver.KotlinLibraryResolveResult
|
||||
import org.jetbrains.kotlin.backend.common.phaser.PhaseConfig
|
||||
import org.jetbrains.kotlin.backend.common.phaser.invokeToplevel
|
||||
import org.jetbrains.kotlin.config.CompilerConfiguration
|
||||
@@ -18,6 +17,7 @@ import org.jetbrains.kotlin.ir.declarations.IrModuleFragment
|
||||
import org.jetbrains.kotlin.ir.util.ExternalDependenciesGenerator
|
||||
import org.jetbrains.kotlin.ir.util.patchDeclarationParents
|
||||
import org.jetbrains.kotlin.library.KotlinLibrary
|
||||
import org.jetbrains.kotlin.library.resolver.KotlinLibraryResolveResult
|
||||
import org.jetbrains.kotlin.name.FqName
|
||||
import org.jetbrains.kotlin.psi.KtFile
|
||||
import org.jetbrains.kotlin.utils.DFS
|
||||
@@ -57,12 +57,7 @@ fun compile(
|
||||
|
||||
// Load declarations referenced during `context` initialization
|
||||
dependencyModules.forEach {
|
||||
ExternalDependenciesGenerator(
|
||||
it.descriptor,
|
||||
symbolTable,
|
||||
irBuiltIns,
|
||||
deserializer = deserializer
|
||||
).generateUnboundSymbolsAsDependencies()
|
||||
ExternalDependenciesGenerator(it.descriptor, symbolTable, irBuiltIns, deserializer).generateUnboundSymbolsAsDependencies()
|
||||
}
|
||||
|
||||
val irFiles = dependencyModules.flatMap { it.files } + moduleFragment.files
|
||||
@@ -71,11 +66,7 @@ fun compile(
|
||||
moduleFragment.files += irFiles
|
||||
|
||||
// Create stubs
|
||||
ExternalDependenciesGenerator(
|
||||
moduleDescriptor = moduleDescriptor,
|
||||
symbolTable = symbolTable,
|
||||
irBuiltIns = irBuiltIns
|
||||
).generateUnboundSymbolsAsDependencies()
|
||||
ExternalDependenciesGenerator(moduleDescriptor, symbolTable, irBuiltIns).generateUnboundSymbolsAsDependencies()
|
||||
moduleFragment.patchDeclarationParents()
|
||||
|
||||
moveBodilessDeclarationsToSeparatePlace(context, moduleFragment)
|
||||
|
||||
Reference in New Issue
Block a user