[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
|
package org.jetbrains.kotlin.ir.backend.js
|
||||||
|
|
||||||
import com.intellij.openapi.project.Project
|
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.lower.*
|
||||||
import org.jetbrains.kotlin.backend.common.runOnFilePostfix
|
|
||||||
import org.jetbrains.kotlin.config.CompilerConfiguration
|
import org.jetbrains.kotlin.config.CompilerConfiguration
|
||||||
import org.jetbrains.kotlin.config.languageVersionSettings
|
import org.jetbrains.kotlin.config.languageVersionSettings
|
||||||
import org.jetbrains.kotlin.descriptors.ModuleDescriptor
|
import org.jetbrains.kotlin.descriptors.ModuleDescriptor
|
||||||
@@ -57,7 +57,7 @@ fun compile(
|
|||||||
|
|
||||||
context.performInlining(moduleFragment)
|
context.performInlining(moduleFragment)
|
||||||
|
|
||||||
moduleFragment.files.forEach { context.lower(it) }
|
context.lower(moduleFragment.files)
|
||||||
val transformer = SecondaryCtorLowering.CallsiteRedirectionTransformer(context)
|
val transformer = SecondaryCtorLowering.CallsiteRedirectionTransformer(context)
|
||||||
moduleFragment.files.forEach { it.accept(transformer, null) }
|
moduleFragment.files.forEach { it.accept(transformer, null) }
|
||||||
|
|
||||||
@@ -84,28 +84,34 @@ private fun JsIrBackendContext.performInlining(moduleFragment: IrModuleFragment)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun JsIrBackendContext.lower(file: IrFile) {
|
private fun JsIrBackendContext.lower(files: List<IrFile>) {
|
||||||
LateinitLowering(this, true).lower(file)
|
LateinitLowering(this, true).lower(files)
|
||||||
DefaultArgumentStubGenerator(this).runOnFilePostfix(file)
|
DefaultArgumentStubGenerator(this).runOnFilePostfix(files)
|
||||||
DefaultParameterInjector(this).runOnFilePostfix(file)
|
DefaultParameterInjector(this).runOnFilePostfix(files)
|
||||||
SharedVariablesLowering(this).runOnFilePostfix(file)
|
SharedVariablesLowering(this).runOnFilePostfix(files)
|
||||||
EnumClassLowering(this).runOnFilePostfix(file)
|
EnumClassLowering(this).runOnFilePostfix(files)
|
||||||
EnumUsageLowering(this).lower(file)
|
EnumUsageLowering(this).lower(files)
|
||||||
ReturnableBlockLowering(this).lower(file)
|
ReturnableBlockLowering(this).lower(files)
|
||||||
LocalDeclarationsLowering(this).runOnFilePostfix(file)
|
LocalDeclarationsLowering(this).runOnFilePostfix(files)
|
||||||
InnerClassesLowering(this).runOnFilePostfix(file)
|
InnerClassesLowering(this).runOnFilePostfix(files)
|
||||||
InnerClassConstructorCallsLowering(this).runOnFilePostfix(file)
|
InnerClassConstructorCallsLowering(this).runOnFilePostfix(files)
|
||||||
PropertiesLowering().lower(file)
|
PropertiesLowering().lower(files)
|
||||||
InitializersLowering(this, JsLoweredDeclarationOrigin.CLASS_STATIC_INITIALIZER, false).runOnFilePostfix(file)
|
InitializersLowering(this, JsLoweredDeclarationOrigin.CLASS_STATIC_INITIALIZER, false).runOnFilePostfix(files)
|
||||||
MultipleCatchesLowering(this).lower(file)
|
MultipleCatchesLowering(this).lower(files)
|
||||||
BridgesConstruction(this).runOnFilePostfix(file)
|
BridgesConstruction(this).runOnFilePostfix(files)
|
||||||
TypeOperatorLowering(this).lower(file)
|
TypeOperatorLowering(this).lower(files)
|
||||||
BlockDecomposerLowering(this).runOnFilePostfix(file)
|
BlockDecomposerLowering(this).runOnFilePostfix(files)
|
||||||
SecondaryCtorLowering(this).runOnFilePostfix(file)
|
SecondaryCtorLowering(this).runOnFilePostfix(files)
|
||||||
CallableReferenceLowering(this).lower(file)
|
CallableReferenceLowering(this).lower(files)
|
||||||
IntrinsicifyCallsLowering(this).lower(file)
|
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
|
// TODO find out why duplicates occur
|
||||||
private fun IrModuleFragment.removeDuplicates(): IrModuleFragment {
|
private fun IrModuleFragment.removeDuplicates(): IrModuleFragment {
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user