Revert "Instantiation of annotations for JVM IR with the corresponding feature flag"

because of incorrect rebase

This reverts commit ce0a3a57
This commit is contained in:
Leonid Startsev
2021-07-21 15:23:24 +03:00
parent 5b21444805
commit 3d0126d5dd
59 changed files with 64 additions and 1589 deletions
@@ -1,5 +1,5 @@
/*
* Copyright 2010-2021 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.
*/
@@ -16,7 +16,9 @@ import org.jetbrains.kotlin.ir.expressions.IrMemberAccessExpression
import org.jetbrains.kotlin.ir.expressions.impl.IrGetValueImpl
import org.jetbrains.kotlin.ir.expressions.mapTypeParameters
import org.jetbrains.kotlin.ir.expressions.mapValueParameters
import org.jetbrains.kotlin.ir.symbols.*
import org.jetbrains.kotlin.ir.symbols.IrClassifierSymbol
import org.jetbrains.kotlin.ir.symbols.IrConstructorSymbol
import org.jetbrains.kotlin.ir.symbols.IrSimpleFunctionSymbol
import org.jetbrains.kotlin.ir.symbols.impl.IrVariableSymbolImpl
import org.jetbrains.kotlin.ir.types.IrType
import org.jetbrains.kotlin.ir.types.classifierOrNull
@@ -32,7 +34,7 @@ import org.jetbrains.kotlin.name.Name
@OptIn(ObsoleteDescriptorBasedAPI::class)
abstract class DataClassMembersGenerator(
val context: IrGeneratorContext,
val symbolTable: ReferenceSymbolTable,
val symbolTable: SymbolTable,
val irClass: IrClass,
val origin: IrDeclarationOrigin
) {
@@ -41,24 +43,11 @@ abstract class DataClassMembersGenerator(
inline fun <T : IrDeclaration> T.buildWithScope(builder: (T) -> Unit): T =
also { irDeclaration ->
symbolTable.withReferenceScope(irDeclaration) {
symbolTable.withScope(irDeclaration) {
builder(irDeclaration)
}
}
private val intClass = context.builtIns.int
private val intType = context.builtIns.intType
open val intTimesSymbol: IrSimpleFunctionSymbol =
intClass.unsubstitutedMemberScope.findFirstFunction("times") {
KotlinTypeChecker.DEFAULT.equalTypes(it.valueParameters[0].type, intType)
}.let { symbolTable.referenceSimpleFunction(it) }
open val intPlusSymbol: IrSimpleFunctionSymbol =
intClass.unsubstitutedMemberScope.findFirstFunction("plus") {
KotlinTypeChecker.DEFAULT.equalTypes(it.valueParameters[0].type, intType)
}.let { symbolTable.referenceSimpleFunction(it) }
private inner class MemberFunctionBuilder(
startOffset: Int = UNDEFINED_OFFSET,
endOffset: Int = UNDEFINED_OFFSET,
@@ -217,7 +206,7 @@ abstract class DataClassMembersGenerator(
fun generateToStringMethodBody(properties: List<IrProperty>) {
val irConcat = irConcat()
irConcat.addArgument(irString(irClass.classNameForToString() + "("))
irConcat.addArgument(irString(irClass.name.asString() + "("))
var first = true
for (property in properties) {
if (!first) irConcat.addArgument(irString(", "))
@@ -373,6 +362,4 @@ abstract class DataClassMembersGenerator(
generateToStringMethodBody(properties)
}
}
open fun IrClass.classNameForToString(): String = irClass.name.asString()
}