Skip to content

Commit

Permalink
[K/JS] Revert KT-60785 fix because the 1.9.0 contains old schema for …
Browse files Browse the repository at this point in the history
…functions inlining

This reverts commit b925404.
  • Loading branch information
JSMonk committed Aug 22, 2023
1 parent 3584af4 commit 3db61ef
Show file tree
Hide file tree
Showing 7 changed files with 4 additions and 77 deletions.
Expand Up @@ -727,7 +727,7 @@ private val inlineClassUsageLoweringPhase = makeBodyLoweringPhase(
)

private val autoboxingTransformerPhase = makeBodyLoweringPhase(
{ AutoboxingTransformer(it, shouldCalculateActualTypeForInlinedFunction = true) },
::AutoboxingTransformer,
name = "AutoboxingTransformer",
description = "Insert box/unbox intrinsics"
)
Expand Down
Expand Up @@ -31,10 +31,7 @@ import org.jetbrains.kotlin.ir.util.render

// Copied and adapted from Kotlin/Native

abstract class AbstractValueUsageLowering(
val context: JsCommonBackendContext,
private val shouldCalculateActualTypeForInlinedFunction: Boolean = false
) : AbstractValueUsageTransformer(context.irBuiltIns),
abstract class AbstractValueUsageLowering(val context: JsCommonBackendContext) : AbstractValueUsageTransformer(context.irBuiltIns),
BodyLoweringPass {

val icUtils = context.inlineClassesUtils
Expand All @@ -55,19 +52,11 @@ abstract class AbstractValueUsageLowering(

abstract fun IrExpression.useExpressionAsType(actualType: IrType, expectedType: IrType): IrExpression

protected fun IrExpression.getActualType(): IrType = when (this) {
protected fun IrExpression.getActualType() = when (this) {
is IrConstructorCall -> symbol.owner.returnType
is IrCall -> symbol.owner.realOverrideTarget.returnType
is IrGetField -> this.symbol.owner.type

is IrInlinedFunctionBlock -> {
if (shouldCalculateActualTypeForInlinedFunction) {
inlineCall.getActualType()
} else {
this.type
}
}

is IrTypeOperatorCall -> {
if (operator == IrTypeOperator.REINTERPRET_CAST) {
this.typeOperand
Expand Down Expand Up @@ -131,10 +120,7 @@ abstract class AbstractValueUsageLowering(
)
}

class AutoboxingTransformer(
context: JsCommonBackendContext,
shouldCalculateActualTypeForInlinedFunction: Boolean = false
) : AbstractValueUsageLowering(context, shouldCalculateActualTypeForInlinedFunction) {
class AutoboxingTransformer(context: JsCommonBackendContext) : AbstractValueUsageLowering(context) {
private var processingReturnStack = mutableListOf<IrReturn>()

private fun IrExpression.useReturnableExpressionAsType(expectedType: IrType): IrExpression {
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

This file was deleted.

0 comments on commit 3db61ef

Please sign in to comment.