[JS IR BE] Run each lowering on all files instead of running all lowering on each file
This commit is contained in:
@@ -6,8 +6,8 @@
|
||||
package org.jetbrains.kotlin.ir.backend.js
|
||||
|
||||
import com.intellij.openapi.project.Project
|
||||
import org.jetbrains.kotlin.backend.common.*
|
||||
import org.jetbrains.kotlin.backend.common.lower.*
|
||||
import org.jetbrains.kotlin.backend.common.runOnFilePostfix
|
||||
import org.jetbrains.kotlin.config.CompilerConfiguration
|
||||
import org.jetbrains.kotlin.config.languageVersionSettings
|
||||
import org.jetbrains.kotlin.descriptors.ModuleDescriptor
|
||||
@@ -57,7 +57,7 @@ fun compile(
|
||||
|
||||
context.performInlining(moduleFragment)
|
||||
|
||||
moduleFragment.files.forEach { context.lower(it) }
|
||||
context.lower(moduleFragment.files)
|
||||
val transformer = SecondaryCtorLowering.CallsiteRedirectionTransformer(context)
|
||||
moduleFragment.files.forEach { it.accept(transformer, null) }
|
||||
|
||||
@@ -84,28 +84,34 @@ private fun JsIrBackendContext.performInlining(moduleFragment: IrModuleFragment)
|
||||
}
|
||||
}
|
||||
|
||||
private fun JsIrBackendContext.lower(file: IrFile) {
|
||||
LateinitLowering(this, true).lower(file)
|
||||
DefaultArgumentStubGenerator(this).runOnFilePostfix(file)
|
||||
DefaultParameterInjector(this).runOnFilePostfix(file)
|
||||
SharedVariablesLowering(this).runOnFilePostfix(file)
|
||||
EnumClassLowering(this).runOnFilePostfix(file)
|
||||
EnumUsageLowering(this).lower(file)
|
||||
ReturnableBlockLowering(this).lower(file)
|
||||
LocalDeclarationsLowering(this).runOnFilePostfix(file)
|
||||
InnerClassesLowering(this).runOnFilePostfix(file)
|
||||
InnerClassConstructorCallsLowering(this).runOnFilePostfix(file)
|
||||
PropertiesLowering().lower(file)
|
||||
InitializersLowering(this, JsLoweredDeclarationOrigin.CLASS_STATIC_INITIALIZER, false).runOnFilePostfix(file)
|
||||
MultipleCatchesLowering(this).lower(file)
|
||||
BridgesConstruction(this).runOnFilePostfix(file)
|
||||
TypeOperatorLowering(this).lower(file)
|
||||
BlockDecomposerLowering(this).runOnFilePostfix(file)
|
||||
SecondaryCtorLowering(this).runOnFilePostfix(file)
|
||||
CallableReferenceLowering(this).lower(file)
|
||||
IntrinsicifyCallsLowering(this).lower(file)
|
||||
private fun JsIrBackendContext.lower(files: List<IrFile>) {
|
||||
LateinitLowering(this, true).lower(files)
|
||||
DefaultArgumentStubGenerator(this).runOnFilePostfix(files)
|
||||
DefaultParameterInjector(this).runOnFilePostfix(files)
|
||||
SharedVariablesLowering(this).runOnFilePostfix(files)
|
||||
EnumClassLowering(this).runOnFilePostfix(files)
|
||||
EnumUsageLowering(this).lower(files)
|
||||
ReturnableBlockLowering(this).lower(files)
|
||||
LocalDeclarationsLowering(this).runOnFilePostfix(files)
|
||||
InnerClassesLowering(this).runOnFilePostfix(files)
|
||||
InnerClassConstructorCallsLowering(this).runOnFilePostfix(files)
|
||||
PropertiesLowering().lower(files)
|
||||
InitializersLowering(this, JsLoweredDeclarationOrigin.CLASS_STATIC_INITIALIZER, false).runOnFilePostfix(files)
|
||||
MultipleCatchesLowering(this).lower(files)
|
||||
BridgesConstruction(this).runOnFilePostfix(files)
|
||||
TypeOperatorLowering(this).lower(files)
|
||||
BlockDecomposerLowering(this).runOnFilePostfix(files)
|
||||
SecondaryCtorLowering(this).runOnFilePostfix(files)
|
||||
CallableReferenceLowering(this).lower(files)
|
||||
IntrinsicifyCallsLowering(this).lower(files)
|
||||
}
|
||||
|
||||
private fun FileLoweringPass.lower(files: List<IrFile>) = files.forEach { lower(it) }
|
||||
private fun DeclarationContainerLoweringPass.runOnFilePostfix(files: List<IrFile>) = files.forEach { runOnFilePostfix(it) }
|
||||
private fun BodyLoweringPass.runOnFilePostfix(files: List<IrFile>) = files.forEach { runOnFilePostfix(it) }
|
||||
private fun FunctionLoweringPass.runOnFilePostfix(files: List<IrFile>) = files.forEach { runOnFilePostfix(it) }
|
||||
private fun ClassLoweringPass.runOnFilePostfix(files: List<IrFile>) = files.forEach { runOnFilePostfix(it) }
|
||||
|
||||
// TODO find out why duplicates occur
|
||||
private fun IrModuleFragment.removeDuplicates(): IrModuleFragment {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user