ForLoopsLowering: Eliminate use of @ObsoleteDescriptorBasedAPI.
This commit is contained in:
committed by
Alexander Udalov
parent
b1ce21bc55
commit
132960a695
@@ -12,7 +12,6 @@ import org.jetbrains.kotlin.descriptors.ClassDescriptor
|
||||
import org.jetbrains.kotlin.descriptors.SimpleFunctionDescriptor
|
||||
import org.jetbrains.kotlin.descriptors.findClassAcrossModuleDependencies
|
||||
import org.jetbrains.kotlin.incremental.components.NoLookupLocation
|
||||
import org.jetbrains.kotlin.ir.ObsoleteDescriptorBasedAPI
|
||||
import org.jetbrains.kotlin.ir.declarations.IrFunction
|
||||
import org.jetbrains.kotlin.ir.declarations.IrModuleFragment
|
||||
import org.jetbrains.kotlin.ir.declarations.IrPackageFragment
|
||||
@@ -111,9 +110,6 @@ open class BuiltinSymbolsBase(protected val irBuiltIns: IrBuiltIns, protected va
|
||||
val longProgression = progression("LongProgression")
|
||||
val progressionClasses = listOfNotNull(charProgression, intProgression, longProgression, uIntProgression, uLongProgression)
|
||||
|
||||
@ObsoleteDescriptorBasedAPI
|
||||
val progressionClassesTypes = progressionClasses.map { it.descriptor.defaultType }.toSet()
|
||||
|
||||
val getProgressionLastElementByReturnType = builtInsPackage("kotlin", "internal")
|
||||
.getContributedFunctions(Name.identifier("getProgressionLastElement"), NoLookupLocation.FROM_BACKEND)
|
||||
.filter { it.containingDeclaration !is BuiltInsPackageFragment }
|
||||
@@ -155,9 +151,6 @@ open class BuiltinSymbolsBase(protected val irBuiltIns: IrBuiltIns, protected va
|
||||
|
||||
val integerClasses = listOf(byte, short, int, long)
|
||||
|
||||
@ObsoleteDescriptorBasedAPI
|
||||
val integerClassesTypes = integerClasses.map { it.descriptor.defaultType }
|
||||
|
||||
val arrayOf = getSimpleFunction(Name.identifier("arrayOf")) {
|
||||
it.extensionReceiverParameter == null && it.dispatchReceiverParameter == null && it.valueParameters.size == 1 &&
|
||||
it.valueParameters[0].isVararg
|
||||
|
||||
-3
@@ -10,7 +10,6 @@ package org.jetbrains.kotlin.backend.common.lower.loops
|
||||
import org.jetbrains.kotlin.backend.common.CommonBackendContext
|
||||
import org.jetbrains.kotlin.backend.common.ir.Symbols
|
||||
import org.jetbrains.kotlin.backend.common.lower.DeclarationIrBuilder
|
||||
import org.jetbrains.kotlin.ir.ObsoleteDescriptorBasedAPI
|
||||
import org.jetbrains.kotlin.ir.builders.irChar
|
||||
import org.jetbrains.kotlin.ir.builders.irInt
|
||||
import org.jetbrains.kotlin.ir.builders.irLong
|
||||
@@ -190,7 +189,6 @@ internal abstract class UnsignedProgressionType(
|
||||
}
|
||||
}
|
||||
|
||||
@OptIn(ObsoleteDescriptorBasedAPI::class)
|
||||
internal class UIntProgressionType(symbols: Symbols<CommonBackendContext>) :
|
||||
UnsignedProgressionType(
|
||||
symbols,
|
||||
@@ -208,7 +206,6 @@ internal class UIntProgressionType(symbols: Symbols<CommonBackendContext>) :
|
||||
override fun DeclarationIrBuilder.zeroStepExpression() = irInt(0)
|
||||
}
|
||||
|
||||
@OptIn(ObsoleteDescriptorBasedAPI::class)
|
||||
internal class ULongProgressionType(symbols: Symbols<CommonBackendContext>) :
|
||||
UnsignedProgressionType(
|
||||
symbols,
|
||||
|
||||
+3
-5
@@ -10,18 +10,16 @@ import org.jetbrains.kotlin.backend.common.lower.loops.HeaderInfoBuilder
|
||||
import org.jetbrains.kotlin.backend.common.lower.loops.HeaderInfoFromCallHandler
|
||||
import org.jetbrains.kotlin.backend.common.lower.matchers.Quantifier
|
||||
import org.jetbrains.kotlin.backend.common.lower.matchers.createIrCallMatcher
|
||||
import org.jetbrains.kotlin.ir.ObsoleteDescriptorBasedAPI
|
||||
import org.jetbrains.kotlin.ir.expressions.IrCall
|
||||
import org.jetbrains.kotlin.ir.symbols.IrSymbol
|
||||
import org.jetbrains.kotlin.ir.types.toKotlinType
|
||||
import org.jetbrains.kotlin.ir.types.defaultType
|
||||
import org.jetbrains.kotlin.name.FqName
|
||||
|
||||
/** Builds a [HeaderInfo] for calls to reverse an iterable. */
|
||||
@OptIn(ObsoleteDescriptorBasedAPI::class)
|
||||
internal class ReversedHandler(context: CommonBackendContext, private val visitor: HeaderInfoBuilder) :
|
||||
HeaderInfoFromCallHandler<Nothing?> {
|
||||
|
||||
private val symbols = context.ir.symbols
|
||||
private val progressionClassesTypes = context.ir.symbols.progressionClasses.map { it.defaultType }.toSet()
|
||||
|
||||
// Use Quantifier.ANY so we can handle all reversed iterables in the same manner.
|
||||
override val matcher =
|
||||
@@ -29,7 +27,7 @@ internal class ReversedHandler(context: CommonBackendContext, private val visito
|
||||
// Matcher for reversed progression.
|
||||
callee {
|
||||
fqName { it == FqName("kotlin.ranges.reversed") }
|
||||
extensionReceiver { it != null && it.type.toKotlinType() in symbols.progressionClassesTypes }
|
||||
extensionReceiver { it != null && it.type in progressionClassesTypes }
|
||||
parameterCount { it == 0 }
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user