Remove descriptor usage from Scope.kt

This commit is contained in:
Georgy Bronnikov
2020-10-16 14:36:27 +03:00
parent 8d999a2c13
commit e5cf7a1be7
6 changed files with 18 additions and 132 deletions
@@ -375,19 +375,6 @@ val IrDeclaration.isTopLevel: Boolean
return parentClass?.isFileClass == true && parentClass.parent is IrPackageFragment
}
fun Scope.createTemporaryVariableWithWrappedDescriptor(
irExpression: IrExpression,
nameHint: String? = null,
isMutable: Boolean = false,
origin: IrDeclarationOrigin = IrDeclarationOrigin.IR_TEMPORARY_VARIABLE
): IrVariable {
val descriptor = WrappedVariableDescriptor()
return createTemporaryVariableWithGivenDescriptor(
irExpression, nameHint, isMutable, origin, descriptor
).apply { descriptor.bind(this) }
}
fun IrClass.createImplicitParameterDeclarationWithWrappedDescriptor() {
thisReceiver = buildReceiverParameter(this, IrDeclarationOrigin.INSTANCE_RECEIVER, symbol.typeWithParameters(typeParameters))
}
@@ -8,7 +8,6 @@ package org.jetbrains.kotlin.backend.common.lower.inline
import org.jetbrains.kotlin.backend.common.*
import org.jetbrains.kotlin.backend.common.ir.Symbols
import org.jetbrains.kotlin.backend.common.ir.createTemporaryVariableWithWrappedDescriptor
import org.jetbrains.kotlin.backend.common.ir.getNewWrappedDescriptor
import org.jetbrains.kotlin.backend.common.lower.createIrBuilder
import org.jetbrains.kotlin.config.LanguageFeature
@@ -472,7 +471,7 @@ class FunctionInlining(
)
} else {
val newVariable =
currentScope.scope.createTemporaryVariableWithWrappedDescriptor(
currentScope.scope.createTemporaryVariable(
irExpression = it.argumentExpression.transform( // Arguments may reference the previous ones - substitute them.
substitutor,
data = null
@@ -523,7 +522,7 @@ class FunctionInlining(
val variableInitializer = argument.argumentExpression.transform(substitutor, data = null)
val newVariable =
currentScope.scope.createTemporaryVariableWithWrappedDescriptor(
currentScope.scope.createTemporaryVariable(
irExpression = IrBlockImpl(
variableInitializer.startOffset,
variableInitializer.endOffset,