[JS IR] Remove inline properties with reified parameters
RemoveInlineFunctionsWithReifiedTypeParametersLowering -> RemoveInlineDeclarationsWithReifiedTypeParametersLowering
This commit is contained in:
@@ -21,7 +21,7 @@ import org.jetbrains.kotlin.ir.backend.js.lower.calls.CallsLowering
|
|||||||
import org.jetbrains.kotlin.ir.backend.js.lower.cleanup.CleanupLowering
|
import org.jetbrains.kotlin.ir.backend.js.lower.cleanup.CleanupLowering
|
||||||
import org.jetbrains.kotlin.ir.backend.js.lower.coroutines.JsSuspendFunctionsLowering
|
import org.jetbrains.kotlin.ir.backend.js.lower.coroutines.JsSuspendFunctionsLowering
|
||||||
import org.jetbrains.kotlin.ir.backend.js.lower.inline.CopyInlineFunctionBodyLowering
|
import org.jetbrains.kotlin.ir.backend.js.lower.inline.CopyInlineFunctionBodyLowering
|
||||||
import org.jetbrains.kotlin.ir.backend.js.lower.inline.RemoveInlineFunctionsWithReifiedTypeParametersLowering
|
import org.jetbrains.kotlin.ir.backend.js.lower.inline.RemoveInlineDeclarationsWithReifiedTypeParametersLowering
|
||||||
import org.jetbrains.kotlin.ir.declarations.IrFile
|
import org.jetbrains.kotlin.ir.declarations.IrFile
|
||||||
import org.jetbrains.kotlin.ir.declarations.IrModuleFragment
|
import org.jetbrains.kotlin.ir.declarations.IrModuleFragment
|
||||||
|
|
||||||
@@ -234,8 +234,8 @@ private val copyInlineFunctionBodyLoweringPhase = makeDeclarationTransformerPhas
|
|||||||
prerequisite = setOf(functionInliningPhase)
|
prerequisite = setOf(functionInliningPhase)
|
||||||
)
|
)
|
||||||
|
|
||||||
private val removeInlineFunctionsWithReifiedTypeParametersLoweringPhase = makeDeclarationTransformerPhase(
|
private val removeInlineDeclarationsWithReifiedTypeParametersLoweringPhase = makeDeclarationTransformerPhase(
|
||||||
{ RemoveInlineFunctionsWithReifiedTypeParametersLowering() },
|
{ RemoveInlineDeclarationsWithReifiedTypeParametersLowering() },
|
||||||
name = "RemoveInlineFunctionsWithReifiedTypeParametersLowering",
|
name = "RemoveInlineFunctionsWithReifiedTypeParametersLowering",
|
||||||
description = "Remove Inline functions with reified parameters from context",
|
description = "Remove Inline functions with reified parameters from context",
|
||||||
prerequisite = setOf(functionInliningPhase)
|
prerequisite = setOf(functionInliningPhase)
|
||||||
@@ -571,7 +571,7 @@ private val typeOperatorLoweringPhase = makeBodyLoweringPhase(
|
|||||||
description = "Lower IrTypeOperator with corresponding logic",
|
description = "Lower IrTypeOperator with corresponding logic",
|
||||||
prerequisite = setOf(
|
prerequisite = setOf(
|
||||||
bridgesConstructionPhase,
|
bridgesConstructionPhase,
|
||||||
removeInlineFunctionsWithReifiedTypeParametersLoweringPhase,
|
removeInlineDeclarationsWithReifiedTypeParametersLoweringPhase,
|
||||||
singleAbstractMethodPhase, errorExpressionLoweringPhase
|
singleAbstractMethodPhase, errorExpressionLoweringPhase
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
@@ -704,7 +704,7 @@ val loweringList = listOf<Lowering>(
|
|||||||
localClassesExtractionFromInlineFunctionsPhase,
|
localClassesExtractionFromInlineFunctionsPhase,
|
||||||
functionInliningPhase,
|
functionInliningPhase,
|
||||||
copyInlineFunctionBodyLoweringPhase,
|
copyInlineFunctionBodyLoweringPhase,
|
||||||
removeInlineFunctionsWithReifiedTypeParametersLoweringPhase,
|
removeInlineDeclarationsWithReifiedTypeParametersLoweringPhase,
|
||||||
createScriptFunctionsPhase,
|
createScriptFunctionsPhase,
|
||||||
callableReferenceLowering,
|
callableReferenceLowering,
|
||||||
singleAbstractMethodPhase,
|
singleAbstractMethodPhase,
|
||||||
|
|||||||
+7
-3
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2010-2018 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -9,15 +9,19 @@ import org.jetbrains.kotlin.backend.common.DeclarationTransformer
|
|||||||
import org.jetbrains.kotlin.ir.backend.js.JsIrBackendContext
|
import org.jetbrains.kotlin.ir.backend.js.JsIrBackendContext
|
||||||
import org.jetbrains.kotlin.ir.declarations.IrDeclaration
|
import org.jetbrains.kotlin.ir.declarations.IrDeclaration
|
||||||
import org.jetbrains.kotlin.ir.declarations.IrFunction
|
import org.jetbrains.kotlin.ir.declarations.IrFunction
|
||||||
|
import org.jetbrains.kotlin.ir.declarations.IrProperty
|
||||||
import org.jetbrains.kotlin.ir.declarations.IrValueParameter
|
import org.jetbrains.kotlin.ir.declarations.IrValueParameter
|
||||||
import org.jetbrains.kotlin.ir.expressions.IrBlockBody
|
import org.jetbrains.kotlin.ir.expressions.IrBlockBody
|
||||||
import org.jetbrains.kotlin.ir.util.deepCopyWithSymbols
|
import org.jetbrains.kotlin.ir.util.deepCopyWithSymbols
|
||||||
|
|
||||||
class RemoveInlineFunctionsWithReifiedTypeParametersLowering: DeclarationTransformer {
|
class RemoveInlineDeclarationsWithReifiedTypeParametersLowering: DeclarationTransformer {
|
||||||
|
|
||||||
override fun transformFlat(declaration: IrDeclaration): List<IrDeclaration>? {
|
override fun transformFlat(declaration: IrDeclaration): List<IrDeclaration>? {
|
||||||
|
fun IrFunction.isInlineFunWithReifiedParameter() = isInline && typeParameters.any { it.isReified }
|
||||||
|
|
||||||
if (declaration is IrFunction && declaration.isInline && declaration.typeParameters.any { it.isReified }) {
|
if (declaration is IrFunction && declaration.isInlineFunWithReifiedParameter() ||
|
||||||
|
declaration is IrProperty && declaration.getter?.isInlineFunWithReifiedParameter() == true
|
||||||
|
) {
|
||||||
return emptyList()
|
return emptyList()
|
||||||
}
|
}
|
||||||
|
|
||||||
+5
-5
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -12,7 +12,7 @@ import org.jetbrains.kotlin.backend.common.lower.loops.ForLoopsLowering
|
|||||||
import org.jetbrains.kotlin.backend.common.phaser.*
|
import org.jetbrains.kotlin.backend.common.phaser.*
|
||||||
import org.jetbrains.kotlin.backend.wasm.lower.*
|
import org.jetbrains.kotlin.backend.wasm.lower.*
|
||||||
import org.jetbrains.kotlin.ir.backend.js.lower.*
|
import org.jetbrains.kotlin.ir.backend.js.lower.*
|
||||||
import org.jetbrains.kotlin.ir.backend.js.lower.inline.RemoveInlineFunctionsWithReifiedTypeParametersLowering
|
import org.jetbrains.kotlin.ir.backend.js.lower.inline.RemoveInlineDeclarationsWithReifiedTypeParametersLowering
|
||||||
import org.jetbrains.kotlin.ir.declarations.IrModuleFragment
|
import org.jetbrains.kotlin.ir.declarations.IrModuleFragment
|
||||||
import org.jetbrains.kotlin.ir.util.patchDeclarationParents
|
import org.jetbrains.kotlin.ir.util.patchDeclarationParents
|
||||||
|
|
||||||
@@ -96,8 +96,8 @@ private val functionInliningPhase = makeCustomWasmModulePhase(
|
|||||||
prerequisite = setOf(expectDeclarationsRemovingPhase)
|
prerequisite = setOf(expectDeclarationsRemovingPhase)
|
||||||
)
|
)
|
||||||
|
|
||||||
private val removeInlineFunctionsWithReifiedTypeParametersLoweringPhase = makeWasmModulePhase(
|
private val removeInlineDeclarationsWithReifiedTypeParametersLoweringPhase = makeWasmModulePhase(
|
||||||
{ RemoveInlineFunctionsWithReifiedTypeParametersLowering() },
|
{ RemoveInlineDeclarationsWithReifiedTypeParametersLowering() },
|
||||||
name = "RemoveInlineFunctionsWithReifiedTypeParametersLowering",
|
name = "RemoveInlineFunctionsWithReifiedTypeParametersLowering",
|
||||||
description = "Remove Inline functions with reified parameters from context",
|
description = "Remove Inline functions with reified parameters from context",
|
||||||
prerequisite = setOf(functionInliningPhase)
|
prerequisite = setOf(functionInliningPhase)
|
||||||
@@ -461,7 +461,7 @@ val wasmPhases = NamedCompilerPhase(
|
|||||||
defaultArgumentPatchOverridesPhase then
|
defaultArgumentPatchOverridesPhase then
|
||||||
defaultParameterInjectorPhase then
|
defaultParameterInjectorPhase then
|
||||||
defaultParameterCleanerPhase then
|
defaultParameterCleanerPhase then
|
||||||
removeInlineFunctionsWithReifiedTypeParametersLoweringPhase then
|
removeInlineDeclarationsWithReifiedTypeParametersLoweringPhase then
|
||||||
|
|
||||||
// TODO:
|
// TODO:
|
||||||
// multipleCatchesLoweringPhase then
|
// multipleCatchesLoweringPhase then
|
||||||
|
|||||||
Reference in New Issue
Block a user