Removed IrCallWithShallowCopy

This commit is contained in:
Igor Chevdar
2019-06-26 13:51:57 +03:00
parent 5a01ad799e
commit 1e8f7c2b7d
18 changed files with 221 additions and 733 deletions
@@ -36,6 +36,7 @@ import org.jetbrains.kotlin.fir.visitors.FirVisitor
import org.jetbrains.kotlin.ir.IrElement
import org.jetbrains.kotlin.ir.IrStatement
import org.jetbrains.kotlin.ir.builders.primitiveOp1
import org.jetbrains.kotlin.ir.builders.primitiveOp2
import org.jetbrains.kotlin.ir.declarations.*
import org.jetbrains.kotlin.ir.declarations.impl.*
import org.jetbrains.kotlin.ir.descriptors.IrBuiltIns
@@ -1073,10 +1074,7 @@ internal class Fir2IrVisitor(
FirOperation.GT_EQ -> irBuiltIns.greaterOrEqualFunByOperandType[simpleType] to IrStatementOrigin.GTEQ
else -> throw AssertionError("Unexpected comparison operation: $operation")
}
return IrBinaryPrimitiveImpl(
startOffset, endOffset, booleanType, origin, symbol!!,
first.toIrExpression(), second.toIrExpression()
)
return primitiveOp2(startOffset, endOffset, symbol!!, booleanType, origin, first.toIrExpression(), second.toIrExpression())
}
private fun generateOperatorCall(
@@ -1104,10 +1102,7 @@ internal class Fir2IrVisitor(
val result = if (operation in UNARY_OPERATIONS) {
primitiveOp1(startOffset, endOffset, symbol, type, origin, arguments[0].toIrExpression())
} else {
IrBinaryPrimitiveImpl(
startOffset, endOffset, type, origin, symbol,
arguments[0].toIrExpression(), arguments[1].toIrExpression()
)
primitiveOp2(startOffset, endOffset, symbol, type, origin, arguments[0].toIrExpression(), arguments[1].toIrExpression())
}
if (operation !in NEGATED_OPERATIONS) return result
return primitiveOp1(startOffset, endOffset, irBuiltIns.booleanNotSymbol, booleanType, origin, result)
@@ -417,19 +417,16 @@ class LocalDeclarationsLowering(
}
private fun createNewCall(oldCall: IrCall, newCallee: IrFunction) =
if (oldCall is IrCallWithShallowCopy)
oldCall.shallowCopy(oldCall.origin, newCallee.symbol, oldCall.superQualifierSymbol)
else
IrCallImpl(
oldCall.startOffset, oldCall.endOffset,
newCallee.returnType,
newCallee.symbol,
newCallee.descriptor,
oldCall.typeArgumentsCount,
oldCall.origin, oldCall.superQualifierSymbol
).also {
it.copyTypeArgumentsFrom(oldCall)
}
IrCallImpl(
oldCall.startOffset, oldCall.endOffset,
newCallee.returnType,
newCallee.symbol,
newCallee.descriptor,
oldCall.typeArgumentsCount,
oldCall.origin, oldCall.superQualifierSymbol
).also {
it.copyTypeArgumentsFrom(oldCall)
}
private fun createNewCall(oldCall: IrConstructorCall, newCallee: IrConstructor) =
IrConstructorCallImpl.fromSymbolOwner(
@@ -9,27 +9,19 @@ import org.jetbrains.kotlin.backend.common.FileLoweringPass
import org.jetbrains.kotlin.backend.common.lower.createIrBuilder
import org.jetbrains.kotlin.backend.common.phaser.makeIrFilePhase
import org.jetbrains.kotlin.backend.jvm.JvmBackendContext
import org.jetbrains.kotlin.backend.jvm.intrinsics.IrIntrinsicMethods
import org.jetbrains.kotlin.backend.jvm.intrinsics.KClassJavaProperty
import org.jetbrains.kotlin.ir.IrStatement
import org.jetbrains.kotlin.ir.builders.declarations.buildField
import org.jetbrains.kotlin.ir.builders.irCall
import org.jetbrains.kotlin.ir.builders.irGet
import org.jetbrains.kotlin.ir.declarations.IrClass
import org.jetbrains.kotlin.ir.declarations.IrConstructor
import org.jetbrains.kotlin.ir.declarations.IrFile
import org.jetbrains.kotlin.ir.declarations.IrSimpleFunction
import org.jetbrains.kotlin.ir.declarations.*
import org.jetbrains.kotlin.ir.expressions.IrCall
import org.jetbrains.kotlin.ir.expressions.IrExpression
import org.jetbrains.kotlin.ir.expressions.impl.IrGetterCallImpl
import org.jetbrains.kotlin.ir.symbols.IrClassSymbol
import org.jetbrains.kotlin.ir.symbols.IrSimpleFunctionSymbol
import org.jetbrains.kotlin.ir.types.*
import org.jetbrains.kotlin.ir.types.impl.makeTypeProjection
import org.jetbrains.kotlin.ir.util.functions
import org.jetbrains.kotlin.ir.util.isAnnotationClass
import org.jetbrains.kotlin.ir.util.isKClass
import org.jetbrains.kotlin.ir.util.isNonPrimitiveArray
import org.jetbrains.kotlin.ir.util.*
import org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid
import org.jetbrains.kotlin.ir.visitors.transformChildrenVoid
import org.jetbrains.kotlin.types.Variance
@@ -118,7 +110,7 @@ private class AnnotationLowering(private val context: JvmBackendContext) : FileL
// Check for a property access on a KClass or Array<KClass> field of an
// annotation class instance.
val receiver = subject as? IrGetterCallImpl
val receiver = (subject as? IrCall)?.takeIf { it.symbol.owner.isGetter }
?: return super.visitCall(expression)
val wrapIntoArray = receiver.type.isKClassArray()
@@ -47,12 +47,13 @@ class PropertiesToFieldsLowering(val context: CommonBackendContext) : IrElementT
override fun visitCall(expression: IrCall): IrExpression {
val simpleFunction = (expression.symbol.owner as? IrSimpleFunction) ?: return super.visitCall(expression)
val property = simpleFunction.correspondingProperty ?: return super.visitCall(expression)
val property = simpleFunction.correspondingPropertySymbol?.owner ?: return super.visitCall(expression)
if (shouldSubstituteAccessorWithField(property, simpleFunction)) {
when (expression) {
is IrGetterCallImpl -> return substituteGetter(property, expression)
is IrSetterCallImpl -> return substituteSetter(property, expression)
// property.getter & property.setter might be erased by the above function.
when (simpleFunction.valueParameters.size) {
0 -> return substituteGetter(property, expression)
1 -> return substituteSetter(property, expression)
}
}
@@ -201,18 +201,19 @@ class CallGenerator(statementGenerator: StatementGenerator) : StatementGenerator
)
} else {
val getterSymbol = context.symbolTable.referenceFunction(getMethodDescriptor.original)
IrGetterCallImpl(
IrCallImpl(
startOffset, endOffset,
irType,
getterSymbol,
getMethodDescriptor,
descriptor.typeParametersCount,
dispatchReceiverValue?.load(),
extensionReceiverValue?.load(),
0,
IrStatementOrigin.GET_PROPERTY,
superQualifierSymbol
).apply {
putTypeArguments(call.typeArguments) { it.toIrType() }
dispatchReceiver = dispatchReceiverValue?.load()
extensionReceiver = extensionReceiverValue?.load()
}
}
}
@@ -257,11 +257,11 @@ class OperatorExpressionGenerator(statementGenerator: StatementGenerator) : Stat
val irArgument0 = expression.left!!.genExpr()
val irArgument1 = expression.right!!.genExpr()
val irIdentityEquals = IrBinaryPrimitiveImpl(
val irIdentityEquals = primitiveOp2(
expression.startOffsetSkippingComments, expression.endOffset,
context.irBuiltIns.eqeqeqSymbol,
context.irBuiltIns.booleanType,
irOperator,
context.irBuiltIns.eqeqeqSymbol,
irArgument0, irArgument1
)
@@ -297,11 +297,11 @@ class OperatorExpressionGenerator(statementGenerator: StatementGenerator) : Stat
val eqeqSymbol = context.irBuiltIns.ieee754equalsFunByOperandType[comparisonType] ?: context.irBuiltIns.eqeqSymbol
val irEquals = IrBinaryPrimitiveImpl(
val irEquals = primitiveOp2(
expression.startOffsetSkippingComments, expression.endOffset,
eqeqSymbol,
context.irBuiltIns.booleanType,
irOperator,
eqeqSymbol,
expression.left!!.generateAsPrimitiveNumericComparisonOperand(comparisonInfo?.leftType, comparisonType),
expression.right!!.generateAsPrimitiveNumericComparisonOperand(comparisonInfo?.rightType, comparisonType)
)
@@ -334,20 +334,20 @@ class OperatorExpressionGenerator(statementGenerator: StatementGenerator) : Stat
val comparisonType = comparisonInfo.comparisonType
val eqeqSymbol =
context.irBuiltIns.ieee754equalsFunByOperandType[comparisonType] ?: context.irBuiltIns.eqeqSymbol
IrBinaryPrimitiveImpl(
primitiveOp2(
startOffset, endOffset,
eqeqSymbol,
context.irBuiltIns.booleanType,
irOperator,
eqeqSymbol,
arg1.promoteToPrimitiveNumericType(comparisonInfo.leftType, comparisonType),
arg2.promoteToPrimitiveNumericType(comparisonInfo.rightType, comparisonType)
)
} else {
IrBinaryPrimitiveImpl(
primitiveOp2(
startOffset, endOffset,
context.irBuiltIns.eqeqSymbol,
context.irBuiltIns.booleanType,
irOperator,
context.irBuiltIns.eqeqSymbol,
arg1, arg2
)
}
@@ -421,11 +421,11 @@ class OperatorExpressionGenerator(statementGenerator: StatementGenerator) : Stat
val ktRight = ktExpression.right ?: throw AssertionError("No RHS in ${ktExpression.text}")
return if (comparisonInfo != null) {
IrBinaryPrimitiveImpl(
primitiveOp2(
startOffset, endOffset,
getComparisonOperatorSymbol(origin, comparisonInfo.comparisonType),
context.irBuiltIns.booleanType,
origin,
getComparisonOperatorSymbol(origin, comparisonInfo.comparisonType),
ktLeft.generateAsPrimitiveNumericComparisonOperand(comparisonInfo.leftType, comparisonInfo.comparisonType),
ktRight.generateAsPrimitiveNumericComparisonOperand(comparisonInfo.rightType, comparisonInfo.comparisonType)
)
@@ -433,11 +433,11 @@ class OperatorExpressionGenerator(statementGenerator: StatementGenerator) : Stat
val resolvedCall = getResolvedCall(ktExpression)
?: throw AssertionError("No resolved call for comparison operator ${ktExpression.text}")
IrBinaryPrimitiveImpl(
primitiveOp2(
startOffset, endOffset,
getComparisonOperatorSymbol(origin, context.irBuiltIns.int),
context.irBuiltIns.booleanType,
origin,
getComparisonOperatorSymbol(origin, context.irBuiltIns.int),
generateCall(resolvedCall, ktExpression, origin),
IrConstImpl.int(startOffset, endOffset, context.irBuiltIns.intType, 0)
)
@@ -142,34 +142,36 @@ class AccessorPropertyLValue(
override fun load(): IrExpression =
callReceiver.adjustForCallee(getterDescriptor!!).call { dispatchReceiverValue, extensionReceiverValue ->
IrGetterCallImpl(
IrCallImpl(
startOffset, endOffset,
type,
getter!!, getterDescriptor,
typeArgumentsCount,
dispatchReceiverValue?.load(),
extensionReceiverValue?.load(),
0,
origin,
superQualifier
).apply {
putTypeArguments()
dispatchReceiver = dispatchReceiverValue?.load()
extensionReceiver = extensionReceiverValue?.load()
}
}
override fun store(irExpression: IrExpression) =
callReceiver.adjustForCallee(setterDescriptor!!).call { dispatchReceiverValue, extensionReceiverValue ->
IrSetterCallImpl(
IrCallImpl(
startOffset, endOffset,
context.irBuiltIns.unitType,
setter!!, setterDescriptor,
typeArgumentsCount,
dispatchReceiverValue?.load(),
extensionReceiverValue?.load(),
irExpression,
1,
origin,
superQualifier
).apply {
putTypeArguments()
dispatchReceiver = dispatchReceiverValue?.load()
extensionReceiver = extensionReceiverValue?.load()
putValueArgument(0, irExpression)
}
}
@@ -160,7 +160,15 @@ fun IrBuilderWithScope.irIfNull(type: IrType, subject: IrExpression, thenPart: I
irIfThenElse(type, irEqualsNull(subject), thenPart, elsePart)
fun IrBuilderWithScope.irThrowNpe(origin: IrStatementOrigin? = null) =
IrNullaryPrimitiveImpl(startOffset, endOffset, context.irBuiltIns.nothingType, origin, context.irBuiltIns.throwNpeSymbol)
IrCallImpl(
startOffset, endOffset,
context.irBuiltIns.nothingType,
context.irBuiltIns.throwNpeSymbol,
context.irBuiltIns.throwNpeSymbol.descriptor,
typeArgumentsCount = 0,
valueArgumentsCount = 0,
origin = origin
)
fun IrBuilderWithScope.irIfThenReturnTrue(condition: IrExpression) =
irIfThen(context.irBuiltIns.unitType, condition, irReturnTrue())
@@ -210,29 +218,31 @@ fun IrBuilderWithScope.irNotEquals(arg1: IrExpression, arg2: IrExpression) =
)
fun IrBuilderWithScope.irGet(type: IrType, receiver: IrExpression?, getterSymbol: IrFunctionSymbol): IrCall =
IrGetterCallImpl(
IrCallImpl(
startOffset, endOffset,
type,
getterSymbol as IrSimpleFunctionSymbol,
getterSymbol.descriptor,
typeArgumentsCount = getterSymbol.owner.typeParameters.size,
dispatchReceiver = receiver,
extensionReceiver = null,
valueArgumentsCount = 0,
origin = IrStatementOrigin.GET_PROPERTY
)
).apply {
dispatchReceiver = receiver
}
fun IrBuilderWithScope.irSet(type: IrType, receiver: IrExpression?, setterSymbol: IrFunctionSymbol, value: IrExpression): IrCall =
IrSetterCallImpl(
IrCallImpl(
startOffset, endOffset,
type,
setterSymbol as IrSimpleFunctionSymbol,
setterSymbol.descriptor,
typeArgumentsCount = setterSymbol.owner.typeParameters.size,
dispatchReceiver = receiver,
extensionReceiver = null,
argument = value,
valueArgumentsCount = 1,
origin = IrStatementOrigin.EQ
)
).apply {
dispatchReceiver = receiver
putValueArgument(0, value)
}
fun IrBuilderWithScope.irCall(
callee: IrFunctionSymbol,
@@ -44,7 +44,17 @@ fun primitiveOp2(
origin: IrStatementOrigin,
argument1: IrExpression, argument2: IrExpression
): IrExpression =
IrBinaryPrimitiveImpl(startOffset, endOffset, primitiveOpReturnType, origin, primitiveOpSymbol, argument1, argument2)
IrCallImpl(
startOffset, endOffset,
primitiveOpReturnType,
primitiveOpSymbol, primitiveOpSymbol.descriptor,
typeArgumentsCount = 0,
valueArgumentsCount = 2,
origin = origin
).apply {
putValueArgument(0, argument1)
putValueArgument(1, argument2)
}
fun IrGeneratorContext.constNull(startOffset: Int, endOffset: Int): IrExpression =
IrConstImpl.constNull(startOffset, endOffset, irBuiltIns.nothingNType)
@@ -59,7 +69,15 @@ fun IrGeneratorContext.eqeqeq(startOffset: Int, endOffset: Int, argument1: IrExp
primitiveOp2(startOffset, endOffset, irBuiltIns.eqeqeqSymbol, irBuiltIns.booleanType, IrStatementOrigin.EQEQEQ, argument1, argument2)
fun IrGeneratorContext.throwNpe(startOffset: Int, endOffset: Int, origin: IrStatementOrigin): IrExpression =
IrNullaryPrimitiveImpl(startOffset, endOffset, irBuiltIns.nothingType, origin, irBuiltIns.throwNpeSymbol)
IrCallImpl(
startOffset, endOffset,
irBuiltIns.nothingType,
irBuiltIns.throwNpeSymbol,
irBuiltIns.throwNpeSymbol.descriptor,
typeArgumentsCount = 0,
valueArgumentsCount = 0,
origin = origin
)
fun IrGeneratorContext.constTrue(startOffset: Int, endOffset: Int) =
IrConstImpl.constTrue(startOffset, endOffset, irBuiltIns.booleanType)
@@ -18,13 +18,8 @@ package org.jetbrains.kotlin.ir.expressions
import org.jetbrains.kotlin.descriptors.ClassDescriptor
import org.jetbrains.kotlin.ir.symbols.IrClassSymbol
import org.jetbrains.kotlin.ir.symbols.IrFunctionSymbol
interface IrCall : IrFunctionAccessExpression {
val superQualifier: ClassDescriptor?
val superQualifierSymbol: IrClassSymbol?
}
interface IrCallWithShallowCopy : IrCall {
fun shallowCopy(newOrigin: IrStatementOrigin?, newCallee: IrFunctionSymbol, newSuperQualifier: IrClassSymbol?): IrCall
}
@@ -1,164 +0,0 @@
/*
* Copyright 2010-2016 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.kotlin.ir.expressions.impl
import org.jetbrains.kotlin.descriptors.ClassDescriptor
import org.jetbrains.kotlin.descriptors.FunctionDescriptor
import org.jetbrains.kotlin.ir.expressions.IrCall
import org.jetbrains.kotlin.ir.expressions.IrCallWithShallowCopy
import org.jetbrains.kotlin.ir.expressions.IrExpression
import org.jetbrains.kotlin.ir.expressions.IrStatementOrigin
import org.jetbrains.kotlin.ir.symbols.IrClassSymbol
import org.jetbrains.kotlin.ir.symbols.IrFunctionSymbol
import org.jetbrains.kotlin.ir.types.IrType
import org.jetbrains.kotlin.ir.visitors.IrElementTransformer
import org.jetbrains.kotlin.ir.visitors.IrElementVisitor
abstract class IrPrimitiveCallBase(
startOffset: Int,
endOffset: Int,
type: IrType,
override val origin: IrStatementOrigin?,
override val symbol: IrFunctionSymbol,
override val valueArgumentsCount: Int
) :
IrExpressionBase(startOffset, endOffset, type),
IrCall {
override val descriptor: FunctionDescriptor get() = symbol.descriptor
override val superQualifier: ClassDescriptor? get() = null
override val superQualifierSymbol: IrClassSymbol? get() = null
override val typeArgumentsCount: Int = 0
override fun getTypeArgument(index: Int): IrType? =
throw AssertionError("Primitive $descriptor has no type arguments")
override fun putTypeArgument(index: Int, type: IrType?) {
throw AssertionError("Primitive $descriptor has no type arguments")
}
override var dispatchReceiver: IrExpression?
get() = null
set(value) {
if (value != null)
throw UnsupportedOperationException("Operator call expression can't have a receiver")
}
override var extensionReceiver: IrExpression?
get() = null
set(value) {
if (value != null)
throw UnsupportedOperationException("Operator call expression can't have a receiver")
}
override fun removeValueArgument(index: Int) {
throw AssertionError("Operator call expression can't have a default argument")
}
override fun <R, D> accept(visitor: IrElementVisitor<R, D>, data: D): R {
return visitor.visitCall(this, data)
}
companion object {
const val ARGUMENT0 = 0
const val ARGUMENT1 = 1
}
}
class IrNullaryPrimitiveImpl(
startOffset: Int,
endOffset: Int,
type: IrType,
origin: IrStatementOrigin?,
symbol: IrFunctionSymbol
) : IrPrimitiveCallBase(startOffset, endOffset, type, origin, symbol, 0),
IrCallWithShallowCopy {
override fun getValueArgument(index: Int): IrExpression? = null
override fun putValueArgument(index: Int, valueArgument: IrExpression?) {
throw UnsupportedOperationException("Nullary operator $descriptor doesn't have arguments")
}
override fun <D> acceptChildren(visitor: IrElementVisitor<Unit, D>, data: D) {
// no children
}
override fun <D> transformChildren(transformer: IrElementTransformer<D>, data: D) {
// no children
}
override fun shallowCopy(newOrigin: IrStatementOrigin?, newCallee: IrFunctionSymbol, newSuperQualifier: IrClassSymbol?): IrCall =
IrNullaryPrimitiveImpl(startOffset, endOffset, type, newOrigin, newCallee)
}
class IrBinaryPrimitiveImpl(
startOffset: Int,
endOffset: Int,
type: IrType,
origin: IrStatementOrigin?,
symbol: IrFunctionSymbol
) : IrPrimitiveCallBase(startOffset, endOffset, type, origin, symbol, 2),
IrCallWithShallowCopy {
constructor(
startOffset: Int,
endOffset: Int,
type: IrType,
origin: IrStatementOrigin?,
symbol: IrFunctionSymbol,
argument0: IrExpression,
argument1: IrExpression
) : this(startOffset, endOffset, type, origin, symbol) {
this.argument0 = argument0
this.argument1 = argument1
}
lateinit var argument0: IrExpression
lateinit var argument1: IrExpression
override fun getValueArgument(index: Int): IrExpression? {
return when (index) {
ARGUMENT0 -> argument0
ARGUMENT1 -> argument1
else -> null
}
}
override fun putValueArgument(index: Int, valueArgument: IrExpression?) {
val argument = valueArgument ?: throw AssertionError("Primitive call $descriptor argument is null")
when (index) {
ARGUMENT0 -> argument0 = argument
ARGUMENT1 -> argument1 = argument
else -> throw AssertionError("Primitive call $descriptor: no such argument index $index")
}
}
override fun <D> acceptChildren(visitor: IrElementVisitor<Unit, D>, data: D) {
argument0.accept(visitor, data)
argument1.accept(visitor, data)
}
override fun <D> transformChildren(transformer: IrElementTransformer<D>, data: D) {
argument0 = argument0.transform(transformer, data)
argument1 = argument1.transform(transformer, data)
}
override fun shallowCopy(newOrigin: IrStatementOrigin?, newCallee: IrFunctionSymbol, newSuperQualifier: IrClassSymbol?): IrCall =
IrBinaryPrimitiveImpl(startOffset, endOffset, type, newOrigin, newCallee)
}
@@ -1,164 +0,0 @@
/*
* Copyright 2010-2016 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.kotlin.ir.expressions.impl
import org.jetbrains.kotlin.descriptors.ClassDescriptor
import org.jetbrains.kotlin.descriptors.FunctionDescriptor
import org.jetbrains.kotlin.ir.expressions.*
import org.jetbrains.kotlin.ir.symbols.IrClassSymbol
import org.jetbrains.kotlin.ir.symbols.IrFunctionSymbol
import org.jetbrains.kotlin.ir.types.IrType
import org.jetbrains.kotlin.ir.visitors.IrElementTransformer
import org.jetbrains.kotlin.ir.visitors.IrElementVisitor
abstract class IrPropertyAccessorCallBase(
startOffset: Int, endOffset: Int,
type: IrType,
override val symbol: IrFunctionSymbol,
override val descriptor: FunctionDescriptor,
typeArgumentsCount: Int,
valueArgumentsCount: Int,
origin: IrStatementOrigin? = null,
override val superQualifierSymbol: IrClassSymbol? = null
) :
IrMemberAccessExpressionBase(startOffset, endOffset, type, typeArgumentsCount, valueArgumentsCount, origin),
IrCall {
override val superQualifier: ClassDescriptor? get() = superQualifierSymbol?.descriptor
override fun <R, D> accept(visitor: IrElementVisitor<R, D>, data: D): R {
return visitor.visitCall(this, data)
}
companion object {
const val SETTER_ARGUMENT_INDEX = 0
}
}
class IrGetterCallImpl(
startOffset: Int,
endOffset: Int,
type: IrType,
symbol: IrFunctionSymbol,
descriptor: FunctionDescriptor,
typeArgumentsCount: Int,
origin: IrStatementOrigin? = null,
superQualifierSymbol: IrClassSymbol? = null
) :
IrPropertyAccessorCallBase(startOffset, endOffset, type, symbol, descriptor, typeArgumentsCount, 0, origin, superQualifierSymbol),
IrCallWithShallowCopy {
constructor(
startOffset: Int,
endOffset: Int,
type: IrType,
symbol: IrFunctionSymbol,
descriptor: FunctionDescriptor,
typeArgumentsCount: Int,
dispatchReceiver: IrExpression?,
extensionReceiver: IrExpression?,
origin: IrStatementOrigin? = null,
superQualifierSymbol: IrClassSymbol? = null
) : this(startOffset, endOffset, type, symbol, descriptor, typeArgumentsCount, origin, superQualifierSymbol) {
this.dispatchReceiver = dispatchReceiver
this.extensionReceiver = extensionReceiver
}
override fun getValueArgument(index: Int): IrExpression? = null
override fun putValueArgument(index: Int, valueArgument: IrExpression?) {
throw UnsupportedOperationException("Property setter call has no arguments")
}
override fun removeValueArgument(index: Int) {
throw UnsupportedOperationException("Property getter call has no arguments")
}
override fun shallowCopy(newOrigin: IrStatementOrigin?, newCallee: IrFunctionSymbol, newSuperQualifier: IrClassSymbol?): IrCall =
IrGetterCallImpl(
startOffset, endOffset, type, newCallee,
descriptor, // TODO substitute descriptor for new callee?
typeArgumentsCount, dispatchReceiver, extensionReceiver, newOrigin, newSuperQualifier
).also { newCall ->
newCall.copyTypeArgumentsFrom(this)
}
}
class IrSetterCallImpl(
startOffset: Int, endOffset: Int,
type: IrType,
symbol: IrFunctionSymbol,
descriptor: FunctionDescriptor,
typeArgumentsCount: Int,
origin: IrStatementOrigin? = null,
superQualifierSymbol: IrClassSymbol? = null
) :
IrPropertyAccessorCallBase(startOffset, endOffset, type, symbol, descriptor, typeArgumentsCount, 1, origin, superQualifierSymbol),
IrCallWithShallowCopy {
constructor(
startOffset: Int,
endOffset: Int,
type: IrType,
symbol: IrFunctionSymbol,
descriptor: FunctionDescriptor,
typeArgumentsCount: Int,
dispatchReceiver: IrExpression?,
extensionReceiver: IrExpression?,
argument: IrExpression,
origin: IrStatementOrigin? = null,
superQualifierSymbol: IrClassSymbol? = null
) : this(startOffset, endOffset, type, symbol, descriptor, typeArgumentsCount, origin, superQualifierSymbol) {
this.dispatchReceiver = dispatchReceiver
this.extensionReceiver = extensionReceiver
putValueArgument(SETTER_ARGUMENT_INDEX, argument)
}
private var argumentImpl: IrExpression? = null
override fun getValueArgument(index: Int): IrExpression? =
if (index == SETTER_ARGUMENT_INDEX) argumentImpl!! else null
override fun putValueArgument(index: Int, valueArgument: IrExpression?) {
if (index != SETTER_ARGUMENT_INDEX) throw AssertionError("Property setter call $descriptor has no argument $index")
argumentImpl = valueArgument
}
override fun removeValueArgument(index: Int) {
if (index != SETTER_ARGUMENT_INDEX) throw AssertionError("Property setter call $descriptor has no argument $index")
argumentImpl = null
}
override fun shallowCopy(newOrigin: IrStatementOrigin?, newCallee: IrFunctionSymbol, newSuperQualifier: IrClassSymbol?): IrCall =
IrSetterCallImpl(
startOffset, endOffset, type, newCallee,
descriptor, // TODO substitute newCallee.descriptor?
typeArgumentsCount, dispatchReceiver, extensionReceiver, argumentImpl!!, newOrigin, newSuperQualifier
).also { newCall ->
newCall.copyTypeArgumentsFrom(this)
}
override fun <D> transformChildren(transformer: IrElementTransformer<D>, data: D) {
super.transformChildren(transformer, data)
argumentImpl = argumentImpl?.transform(transformer, data)
}
override fun <D> acceptChildren(visitor: IrElementVisitor<Unit, D>, data: D) {
super.acceptChildren(visitor, data)
argumentImpl?.accept(visitor, data)
}
}
@@ -98,17 +98,17 @@ val IrDeclaration.fileEntry: SourceManager.FileEntry
fun IrClass.companionObject() = this.declarations.singleOrNull {it is IrClass && it.isCompanion }
val IrDeclaration.isGetter get() = this is IrSimpleFunction && this == this.correspondingProperty?.getter
val IrDeclaration.isGetter get() = this is IrSimpleFunction && this == this.correspondingPropertySymbol?.owner?.getter
val IrDeclaration.isSetter get() = this is IrSimpleFunction && this == this.correspondingProperty?.setter
val IrDeclaration.isSetter get() = this is IrSimpleFunction && this == this.correspondingPropertySymbol?.owner?.setter
val IrDeclaration.isAccessor get() = this.isGetter || this.isSetter
val IrDeclaration.isPropertyAccessor get() =
this is IrSimpleFunction && this.correspondingProperty != null
this is IrSimpleFunction && this.correspondingPropertySymbol != null
val IrDeclaration.isPropertyField get() =
this is IrField && this.correspondingProperty != null
this is IrField && this.correspondingPropertySymbol != null
val IrDeclaration.isTopLevelDeclaration get() =
parent !is IrDeclaration && !this.isPropertyAccessor && !this.isPropertyField
@@ -117,9 +117,9 @@ fun IrDeclaration.findTopLevelDeclaration(): IrDeclaration = when {
this.isTopLevelDeclaration ->
this
this.isPropertyAccessor ->
(this as IrSimpleFunction).correspondingProperty!!.findTopLevelDeclaration()
(this as IrSimpleFunction).correspondingPropertySymbol!!.owner.findTopLevelDeclaration()
this.isPropertyField ->
(this as IrField).correspondingProperty!!.findTopLevelDeclaration()
(this as IrField).correspondingPropertySymbol!!.owner.findTopLevelDeclaration()
else ->
(this.parent as IrDeclaration).findTopLevelDeclaration()
}
@@ -483,30 +483,21 @@ open class DeepCopyIrTreeWithSymbols(
}
}
private fun shallowCopyCall(expression: IrCall) =
when (expression) {
is IrCallWithShallowCopy ->
expression.shallowCopy(
mapStatementOrigin(expression.origin),
symbolRemapper.getReferencedFunction(expression.symbol),
symbolRemapper.getReferencedClassOrNull(expression.superQualifierSymbol)
)
else -> {
val newCallee = symbolRemapper.getReferencedFunction(expression.symbol)
IrCallImpl(
expression.startOffset, expression.endOffset,
expression.type.remapType(),
newCallee,
newCallee.descriptor,
expression.typeArgumentsCount,
expression.valueArgumentsCount,
mapStatementOrigin(expression.origin),
symbolRemapper.getReferencedClassOrNull(expression.superQualifierSymbol)
).apply {
copyRemappedTypeArgumentsFrom(expression)
}
}
private fun shallowCopyCall(expression: IrCall): IrCall {
val newCallee = symbolRemapper.getReferencedFunction(expression.symbol)
return IrCallImpl(
expression.startOffset, expression.endOffset,
expression.type.remapType(),
newCallee,
newCallee.descriptor,
expression.typeArgumentsCount,
expression.valueArgumentsCount,
mapStatementOrigin(expression.origin),
symbolRemapper.getReferencedClassOrNull(expression.superQualifierSymbol)
).apply {
copyRemappedTypeArgumentsFrom(expression)
}
}
private fun <T : IrMemberAccessExpression> T.transformReceiverArguments(original: T): T =
apply {
@@ -227,16 +227,10 @@ message MemberAccessCommon {
}
message IrCall {
enum Primitive {
NOT_PRIMITIVE = 1;
NULLARY = 2;
BINARY = 4;
}
required Primitive kind = 1;
required IrSymbol symbol = 2;
required MemberAccessCommon member_access = 3;
optional IrSymbol super = 4;
optional IrStatementOrigin origin = 5;
required IrSymbol symbol = 1;
required MemberAccessCommon member_access = 2;
optional IrSymbol super = 3;
optional IrStatementOrigin origin = 4;
}
message IrConstructorCall {
@@ -270,23 +270,16 @@ abstract class IrModuleDeserializer(
val origin = if (proto.hasOrigin()) deserializeIrStatementOrigin(proto.origin) else null
val call: IrCall = when (proto.kind) {
KotlinIr.IrCall.Primitive.NOT_PRIMITIVE ->
// TODO: implement the last three args here.
IrCallImpl(
start, end, type,
symbol, symbol.descriptor,
proto.memberAccess.typeArguments.typeArgumentCount,
proto.memberAccess.valueArgumentList.size,
origin,
superSymbol
)
KotlinIr.IrCall.Primitive.NULLARY ->
IrNullaryPrimitiveImpl(start, end, type, origin, symbol)
KotlinIr.IrCall.Primitive.BINARY ->
IrBinaryPrimitiveImpl(start, end, type, origin, symbol)
else -> TODO("Unexpected primitive IrCall.")
}
val call: IrCall =
// TODO: implement the last three args here.
IrCallImpl(
start, end, type,
symbol, symbol.descriptor,
proto.memberAccess.typeArguments.typeArgumentCount,
proto.memberAccess.valueArgumentList.size,
origin,
superSymbol
)
deserializeMemberAccessCommon(call, proto.memberAccess)
return call
}
@@ -20,8 +20,6 @@ import org.jetbrains.kotlin.ir.IrElement
import org.jetbrains.kotlin.ir.SourceManager
import org.jetbrains.kotlin.ir.declarations.*
import org.jetbrains.kotlin.ir.expressions.*
import org.jetbrains.kotlin.ir.expressions.impl.IrBinaryPrimitiveImpl
import org.jetbrains.kotlin.ir.expressions.impl.IrNullaryPrimitiveImpl
import org.jetbrains.kotlin.ir.symbols.*
import org.jetbrains.kotlin.ir.types.*
import org.jetbrains.kotlin.ir.util.findTopLevelDeclaration
@@ -355,15 +353,6 @@ open class IrModuleSerializer(
return proto.build()
}
private fun irCallToPrimitiveKind(call: IrCall): KotlinIr.IrCall.Primitive = when (call) {
is IrNullaryPrimitiveImpl
-> KotlinIr.IrCall.Primitive.NULLARY
is IrBinaryPrimitiveImpl
-> KotlinIr.IrCall.Primitive.BINARY
else
-> KotlinIr.IrCall.Primitive.NOT_PRIMITIVE
}
private fun serializeMemberAccessCommon(call: IrMemberAccessExpression): KotlinIr.MemberAccessCommon {
val proto = KotlinIr.MemberAccessCommon.newBuilder()
if (call.extensionReceiver != null) {
@@ -395,7 +384,6 @@ open class IrModuleSerializer(
private fun serializeCall(call: IrCall): KotlinIr.IrCall {
val proto = KotlinIr.IrCall.newBuilder()
proto.kind = irCallToPrimitiveKind(call)
proto.symbol = serializeIrSymbol(call.symbol)
call.origin?.let { proto.origin = serializeIrStatementOrigin(it) }
@@ -17518,47 +17518,38 @@ public final class KotlinIr {
org.jetbrains.kotlin.protobuf.MessageLiteOrBuilder {
/**
* <code>required .org.jetbrains.kotlin.backend.common.serialization.IrCall.Primitive kind = 1;</code>
*/
boolean hasKind();
/**
* <code>required .org.jetbrains.kotlin.backend.common.serialization.IrCall.Primitive kind = 1;</code>
*/
org.jetbrains.kotlin.backend.common.serialization.KotlinIr.IrCall.Primitive getKind();
/**
* <code>required .org.jetbrains.kotlin.backend.common.serialization.IrSymbol symbol = 2;</code>
* <code>required .org.jetbrains.kotlin.backend.common.serialization.IrSymbol symbol = 1;</code>
*/
boolean hasSymbol();
/**
* <code>required .org.jetbrains.kotlin.backend.common.serialization.IrSymbol symbol = 2;</code>
* <code>required .org.jetbrains.kotlin.backend.common.serialization.IrSymbol symbol = 1;</code>
*/
org.jetbrains.kotlin.backend.common.serialization.KotlinIr.IrSymbol getSymbol();
/**
* <code>required .org.jetbrains.kotlin.backend.common.serialization.MemberAccessCommon member_access = 3;</code>
* <code>required .org.jetbrains.kotlin.backend.common.serialization.MemberAccessCommon member_access = 2;</code>
*/
boolean hasMemberAccess();
/**
* <code>required .org.jetbrains.kotlin.backend.common.serialization.MemberAccessCommon member_access = 3;</code>
* <code>required .org.jetbrains.kotlin.backend.common.serialization.MemberAccessCommon member_access = 2;</code>
*/
org.jetbrains.kotlin.backend.common.serialization.KotlinIr.MemberAccessCommon getMemberAccess();
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.IrSymbol super = 4;</code>
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.IrSymbol super = 3;</code>
*/
boolean hasSuper();
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.IrSymbol super = 4;</code>
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.IrSymbol super = 3;</code>
*/
org.jetbrains.kotlin.backend.common.serialization.KotlinIr.IrSymbol getSuper();
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.IrStatementOrigin origin = 5;</code>
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.IrStatementOrigin origin = 4;</code>
*/
boolean hasOrigin();
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.IrStatementOrigin origin = 5;</code>
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.IrStatementOrigin origin = 4;</code>
*/
org.jetbrains.kotlin.backend.common.serialization.KotlinIr.IrStatementOrigin getOrigin();
}
@@ -17612,21 +17603,9 @@ public final class KotlinIr {
}
break;
}
case 8: {
int rawValue = input.readEnum();
org.jetbrains.kotlin.backend.common.serialization.KotlinIr.IrCall.Primitive value = org.jetbrains.kotlin.backend.common.serialization.KotlinIr.IrCall.Primitive.valueOf(rawValue);
if (value == null) {
unknownFieldsCodedOutput.writeRawVarint32(tag);
unknownFieldsCodedOutput.writeRawVarint32(rawValue);
} else {
bitField0_ |= 0x00000001;
kind_ = value;
}
break;
}
case 18: {
case 10: {
org.jetbrains.kotlin.backend.common.serialization.KotlinIr.IrSymbol.Builder subBuilder = null;
if (((bitField0_ & 0x00000002) == 0x00000002)) {
if (((bitField0_ & 0x00000001) == 0x00000001)) {
subBuilder = symbol_.toBuilder();
}
symbol_ = input.readMessage(org.jetbrains.kotlin.backend.common.serialization.KotlinIr.IrSymbol.PARSER, extensionRegistry);
@@ -17634,12 +17613,12 @@ public final class KotlinIr {
subBuilder.mergeFrom(symbol_);
symbol_ = subBuilder.buildPartial();
}
bitField0_ |= 0x00000002;
bitField0_ |= 0x00000001;
break;
}
case 26: {
case 18: {
org.jetbrains.kotlin.backend.common.serialization.KotlinIr.MemberAccessCommon.Builder subBuilder = null;
if (((bitField0_ & 0x00000004) == 0x00000004)) {
if (((bitField0_ & 0x00000002) == 0x00000002)) {
subBuilder = memberAccess_.toBuilder();
}
memberAccess_ = input.readMessage(org.jetbrains.kotlin.backend.common.serialization.KotlinIr.MemberAccessCommon.PARSER, extensionRegistry);
@@ -17647,12 +17626,12 @@ public final class KotlinIr {
subBuilder.mergeFrom(memberAccess_);
memberAccess_ = subBuilder.buildPartial();
}
bitField0_ |= 0x00000004;
bitField0_ |= 0x00000002;
break;
}
case 34: {
case 26: {
org.jetbrains.kotlin.backend.common.serialization.KotlinIr.IrSymbol.Builder subBuilder = null;
if (((bitField0_ & 0x00000008) == 0x00000008)) {
if (((bitField0_ & 0x00000004) == 0x00000004)) {
subBuilder = super_.toBuilder();
}
super_ = input.readMessage(org.jetbrains.kotlin.backend.common.serialization.KotlinIr.IrSymbol.PARSER, extensionRegistry);
@@ -17660,12 +17639,12 @@ public final class KotlinIr {
subBuilder.mergeFrom(super_);
super_ = subBuilder.buildPartial();
}
bitField0_ |= 0x00000008;
bitField0_ |= 0x00000004;
break;
}
case 42: {
case 34: {
org.jetbrains.kotlin.backend.common.serialization.KotlinIr.IrStatementOrigin.Builder subBuilder = null;
if (((bitField0_ & 0x00000010) == 0x00000010)) {
if (((bitField0_ & 0x00000008) == 0x00000008)) {
subBuilder = origin_.toBuilder();
}
origin_ = input.readMessage(org.jetbrains.kotlin.backend.common.serialization.KotlinIr.IrStatementOrigin.PARSER, extensionRegistry);
@@ -17673,7 +17652,7 @@ public final class KotlinIr {
subBuilder.mergeFrom(origin_);
origin_ = subBuilder.buildPartial();
}
bitField0_ |= 0x00000010;
bitField0_ |= 0x00000008;
break;
}
}
@@ -17709,149 +17688,68 @@ public final class KotlinIr {
return PARSER;
}
/**
* Protobuf enum {@code org.jetbrains.kotlin.backend.common.serialization.IrCall.Primitive}
*/
public enum Primitive
implements org.jetbrains.kotlin.protobuf.Internal.EnumLite {
/**
* <code>NOT_PRIMITIVE = 1;</code>
*/
NOT_PRIMITIVE(0, 1),
/**
* <code>NULLARY = 2;</code>
*/
NULLARY(1, 2),
/**
* <code>BINARY = 4;</code>
*/
BINARY(2, 4),
;
/**
* <code>NOT_PRIMITIVE = 1;</code>
*/
public static final int NOT_PRIMITIVE_VALUE = 1;
/**
* <code>NULLARY = 2;</code>
*/
public static final int NULLARY_VALUE = 2;
/**
* <code>BINARY = 4;</code>
*/
public static final int BINARY_VALUE = 4;
public final int getNumber() { return value; }
public static Primitive valueOf(int value) {
switch (value) {
case 1: return NOT_PRIMITIVE;
case 2: return NULLARY;
case 4: return BINARY;
default: return null;
}
}
public static org.jetbrains.kotlin.protobuf.Internal.EnumLiteMap<Primitive>
internalGetValueMap() {
return internalValueMap;
}
private static org.jetbrains.kotlin.protobuf.Internal.EnumLiteMap<Primitive>
internalValueMap =
new org.jetbrains.kotlin.protobuf.Internal.EnumLiteMap<Primitive>() {
public Primitive findValueByNumber(int number) {
return Primitive.valueOf(number);
}
};
private final int value;
private Primitive(int index, int value) {
this.value = value;
}
// @@protoc_insertion_point(enum_scope:org.jetbrains.kotlin.backend.common.serialization.IrCall.Primitive)
}
private int bitField0_;
public static final int KIND_FIELD_NUMBER = 1;
private org.jetbrains.kotlin.backend.common.serialization.KotlinIr.IrCall.Primitive kind_;
public static final int SYMBOL_FIELD_NUMBER = 1;
private org.jetbrains.kotlin.backend.common.serialization.KotlinIr.IrSymbol symbol_;
/**
* <code>required .org.jetbrains.kotlin.backend.common.serialization.IrCall.Primitive kind = 1;</code>
* <code>required .org.jetbrains.kotlin.backend.common.serialization.IrSymbol symbol = 1;</code>
*/
public boolean hasKind() {
public boolean hasSymbol() {
return ((bitField0_ & 0x00000001) == 0x00000001);
}
/**
* <code>required .org.jetbrains.kotlin.backend.common.serialization.IrCall.Primitive kind = 1;</code>
*/
public org.jetbrains.kotlin.backend.common.serialization.KotlinIr.IrCall.Primitive getKind() {
return kind_;
}
public static final int SYMBOL_FIELD_NUMBER = 2;
private org.jetbrains.kotlin.backend.common.serialization.KotlinIr.IrSymbol symbol_;
/**
* <code>required .org.jetbrains.kotlin.backend.common.serialization.IrSymbol symbol = 2;</code>
*/
public boolean hasSymbol() {
return ((bitField0_ & 0x00000002) == 0x00000002);
}
/**
* <code>required .org.jetbrains.kotlin.backend.common.serialization.IrSymbol symbol = 2;</code>
* <code>required .org.jetbrains.kotlin.backend.common.serialization.IrSymbol symbol = 1;</code>
*/
public org.jetbrains.kotlin.backend.common.serialization.KotlinIr.IrSymbol getSymbol() {
return symbol_;
}
public static final int MEMBER_ACCESS_FIELD_NUMBER = 3;
public static final int MEMBER_ACCESS_FIELD_NUMBER = 2;
private org.jetbrains.kotlin.backend.common.serialization.KotlinIr.MemberAccessCommon memberAccess_;
/**
* <code>required .org.jetbrains.kotlin.backend.common.serialization.MemberAccessCommon member_access = 3;</code>
* <code>required .org.jetbrains.kotlin.backend.common.serialization.MemberAccessCommon member_access = 2;</code>
*/
public boolean hasMemberAccess() {
return ((bitField0_ & 0x00000004) == 0x00000004);
return ((bitField0_ & 0x00000002) == 0x00000002);
}
/**
* <code>required .org.jetbrains.kotlin.backend.common.serialization.MemberAccessCommon member_access = 3;</code>
* <code>required .org.jetbrains.kotlin.backend.common.serialization.MemberAccessCommon member_access = 2;</code>
*/
public org.jetbrains.kotlin.backend.common.serialization.KotlinIr.MemberAccessCommon getMemberAccess() {
return memberAccess_;
}
public static final int SUPER_FIELD_NUMBER = 4;
public static final int SUPER_FIELD_NUMBER = 3;
private org.jetbrains.kotlin.backend.common.serialization.KotlinIr.IrSymbol super_;
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.IrSymbol super = 4;</code>
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.IrSymbol super = 3;</code>
*/
public boolean hasSuper() {
return ((bitField0_ & 0x00000008) == 0x00000008);
return ((bitField0_ & 0x00000004) == 0x00000004);
}
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.IrSymbol super = 4;</code>
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.IrSymbol super = 3;</code>
*/
public org.jetbrains.kotlin.backend.common.serialization.KotlinIr.IrSymbol getSuper() {
return super_;
}
public static final int ORIGIN_FIELD_NUMBER = 5;
public static final int ORIGIN_FIELD_NUMBER = 4;
private org.jetbrains.kotlin.backend.common.serialization.KotlinIr.IrStatementOrigin origin_;
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.IrStatementOrigin origin = 5;</code>
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.IrStatementOrigin origin = 4;</code>
*/
public boolean hasOrigin() {
return ((bitField0_ & 0x00000010) == 0x00000010);
return ((bitField0_ & 0x00000008) == 0x00000008);
}
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.IrStatementOrigin origin = 5;</code>
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.IrStatementOrigin origin = 4;</code>
*/
public org.jetbrains.kotlin.backend.common.serialization.KotlinIr.IrStatementOrigin getOrigin() {
return origin_;
}
private void initFields() {
kind_ = org.jetbrains.kotlin.backend.common.serialization.KotlinIr.IrCall.Primitive.NOT_PRIMITIVE;
symbol_ = org.jetbrains.kotlin.backend.common.serialization.KotlinIr.IrSymbol.getDefaultInstance();
memberAccess_ = org.jetbrains.kotlin.backend.common.serialization.KotlinIr.MemberAccessCommon.getDefaultInstance();
super_ = org.jetbrains.kotlin.backend.common.serialization.KotlinIr.IrSymbol.getDefaultInstance();
@@ -17863,10 +17761,6 @@ public final class KotlinIr {
if (isInitialized == 1) return true;
if (isInitialized == 0) return false;
if (!hasKind()) {
memoizedIsInitialized = 0;
return false;
}
if (!hasSymbol()) {
memoizedIsInitialized = 0;
return false;
@@ -17903,19 +17797,16 @@ public final class KotlinIr {
throws java.io.IOException {
getSerializedSize();
if (((bitField0_ & 0x00000001) == 0x00000001)) {
output.writeEnum(1, kind_.getNumber());
output.writeMessage(1, symbol_);
}
if (((bitField0_ & 0x00000002) == 0x00000002)) {
output.writeMessage(2, symbol_);
output.writeMessage(2, memberAccess_);
}
if (((bitField0_ & 0x00000004) == 0x00000004)) {
output.writeMessage(3, memberAccess_);
output.writeMessage(3, super_);
}
if (((bitField0_ & 0x00000008) == 0x00000008)) {
output.writeMessage(4, super_);
}
if (((bitField0_ & 0x00000010) == 0x00000010)) {
output.writeMessage(5, origin_);
output.writeMessage(4, origin_);
}
output.writeRawBytes(unknownFields);
}
@@ -17928,23 +17819,19 @@ public final class KotlinIr {
size = 0;
if (((bitField0_ & 0x00000001) == 0x00000001)) {
size += org.jetbrains.kotlin.protobuf.CodedOutputStream
.computeEnumSize(1, kind_.getNumber());
.computeMessageSize(1, symbol_);
}
if (((bitField0_ & 0x00000002) == 0x00000002)) {
size += org.jetbrains.kotlin.protobuf.CodedOutputStream
.computeMessageSize(2, symbol_);
.computeMessageSize(2, memberAccess_);
}
if (((bitField0_ & 0x00000004) == 0x00000004)) {
size += org.jetbrains.kotlin.protobuf.CodedOutputStream
.computeMessageSize(3, memberAccess_);
.computeMessageSize(3, super_);
}
if (((bitField0_ & 0x00000008) == 0x00000008)) {
size += org.jetbrains.kotlin.protobuf.CodedOutputStream
.computeMessageSize(4, super_);
}
if (((bitField0_ & 0x00000010) == 0x00000010)) {
size += org.jetbrains.kotlin.protobuf.CodedOutputStream
.computeMessageSize(5, origin_);
.computeMessageSize(4, origin_);
}
size += unknownFields.size();
memoizedSerializedSize = size;
@@ -18040,16 +17927,14 @@ public final class KotlinIr {
public Builder clear() {
super.clear();
kind_ = org.jetbrains.kotlin.backend.common.serialization.KotlinIr.IrCall.Primitive.NOT_PRIMITIVE;
bitField0_ = (bitField0_ & ~0x00000001);
symbol_ = org.jetbrains.kotlin.backend.common.serialization.KotlinIr.IrSymbol.getDefaultInstance();
bitField0_ = (bitField0_ & ~0x00000002);
bitField0_ = (bitField0_ & ~0x00000001);
memberAccess_ = org.jetbrains.kotlin.backend.common.serialization.KotlinIr.MemberAccessCommon.getDefaultInstance();
bitField0_ = (bitField0_ & ~0x00000004);
bitField0_ = (bitField0_ & ~0x00000002);
super_ = org.jetbrains.kotlin.backend.common.serialization.KotlinIr.IrSymbol.getDefaultInstance();
bitField0_ = (bitField0_ & ~0x00000008);
bitField0_ = (bitField0_ & ~0x00000004);
origin_ = org.jetbrains.kotlin.backend.common.serialization.KotlinIr.IrStatementOrigin.getDefaultInstance();
bitField0_ = (bitField0_ & ~0x00000010);
bitField0_ = (bitField0_ & ~0x00000008);
return this;
}
@@ -18076,22 +17961,18 @@ public final class KotlinIr {
if (((from_bitField0_ & 0x00000001) == 0x00000001)) {
to_bitField0_ |= 0x00000001;
}
result.kind_ = kind_;
result.symbol_ = symbol_;
if (((from_bitField0_ & 0x00000002) == 0x00000002)) {
to_bitField0_ |= 0x00000002;
}
result.symbol_ = symbol_;
result.memberAccess_ = memberAccess_;
if (((from_bitField0_ & 0x00000004) == 0x00000004)) {
to_bitField0_ |= 0x00000004;
}
result.memberAccess_ = memberAccess_;
result.super_ = super_;
if (((from_bitField0_ & 0x00000008) == 0x00000008)) {
to_bitField0_ |= 0x00000008;
}
result.super_ = super_;
if (((from_bitField0_ & 0x00000010) == 0x00000010)) {
to_bitField0_ |= 0x00000010;
}
result.origin_ = origin_;
result.bitField0_ = to_bitField0_;
return result;
@@ -18099,9 +17980,6 @@ public final class KotlinIr {
public Builder mergeFrom(org.jetbrains.kotlin.backend.common.serialization.KotlinIr.IrCall other) {
if (other == org.jetbrains.kotlin.backend.common.serialization.KotlinIr.IrCall.getDefaultInstance()) return this;
if (other.hasKind()) {
setKind(other.getKind());
}
if (other.hasSymbol()) {
mergeSymbol(other.getSymbol());
}
@@ -18120,10 +17998,6 @@ public final class KotlinIr {
}
public final boolean isInitialized() {
if (!hasKind()) {
return false;
}
if (!hasSymbol()) {
return false;
@@ -18174,56 +18048,21 @@ public final class KotlinIr {
}
private int bitField0_;
private org.jetbrains.kotlin.backend.common.serialization.KotlinIr.IrCall.Primitive kind_ = org.jetbrains.kotlin.backend.common.serialization.KotlinIr.IrCall.Primitive.NOT_PRIMITIVE;
private org.jetbrains.kotlin.backend.common.serialization.KotlinIr.IrSymbol symbol_ = org.jetbrains.kotlin.backend.common.serialization.KotlinIr.IrSymbol.getDefaultInstance();
/**
* <code>required .org.jetbrains.kotlin.backend.common.serialization.IrCall.Primitive kind = 1;</code>
* <code>required .org.jetbrains.kotlin.backend.common.serialization.IrSymbol symbol = 1;</code>
*/
public boolean hasKind() {
public boolean hasSymbol() {
return ((bitField0_ & 0x00000001) == 0x00000001);
}
/**
* <code>required .org.jetbrains.kotlin.backend.common.serialization.IrCall.Primitive kind = 1;</code>
*/
public org.jetbrains.kotlin.backend.common.serialization.KotlinIr.IrCall.Primitive getKind() {
return kind_;
}
/**
* <code>required .org.jetbrains.kotlin.backend.common.serialization.IrCall.Primitive kind = 1;</code>
*/
public Builder setKind(org.jetbrains.kotlin.backend.common.serialization.KotlinIr.IrCall.Primitive value) {
if (value == null) {
throw new NullPointerException();
}
bitField0_ |= 0x00000001;
kind_ = value;
return this;
}
/**
* <code>required .org.jetbrains.kotlin.backend.common.serialization.IrCall.Primitive kind = 1;</code>
*/
public Builder clearKind() {
bitField0_ = (bitField0_ & ~0x00000001);
kind_ = org.jetbrains.kotlin.backend.common.serialization.KotlinIr.IrCall.Primitive.NOT_PRIMITIVE;
return this;
}
private org.jetbrains.kotlin.backend.common.serialization.KotlinIr.IrSymbol symbol_ = org.jetbrains.kotlin.backend.common.serialization.KotlinIr.IrSymbol.getDefaultInstance();
/**
* <code>required .org.jetbrains.kotlin.backend.common.serialization.IrSymbol symbol = 2;</code>
*/
public boolean hasSymbol() {
return ((bitField0_ & 0x00000002) == 0x00000002);
}
/**
* <code>required .org.jetbrains.kotlin.backend.common.serialization.IrSymbol symbol = 2;</code>
* <code>required .org.jetbrains.kotlin.backend.common.serialization.IrSymbol symbol = 1;</code>
*/
public org.jetbrains.kotlin.backend.common.serialization.KotlinIr.IrSymbol getSymbol() {
return symbol_;
}
/**
* <code>required .org.jetbrains.kotlin.backend.common.serialization.IrSymbol symbol = 2;</code>
* <code>required .org.jetbrains.kotlin.backend.common.serialization.IrSymbol symbol = 1;</code>
*/
public Builder setSymbol(org.jetbrains.kotlin.backend.common.serialization.KotlinIr.IrSymbol value) {
if (value == null) {
@@ -18231,24 +18070,24 @@ public final class KotlinIr {
}
symbol_ = value;
bitField0_ |= 0x00000002;
bitField0_ |= 0x00000001;
return this;
}
/**
* <code>required .org.jetbrains.kotlin.backend.common.serialization.IrSymbol symbol = 2;</code>
* <code>required .org.jetbrains.kotlin.backend.common.serialization.IrSymbol symbol = 1;</code>
*/
public Builder setSymbol(
org.jetbrains.kotlin.backend.common.serialization.KotlinIr.IrSymbol.Builder builderForValue) {
symbol_ = builderForValue.build();
bitField0_ |= 0x00000002;
bitField0_ |= 0x00000001;
return this;
}
/**
* <code>required .org.jetbrains.kotlin.backend.common.serialization.IrSymbol symbol = 2;</code>
* <code>required .org.jetbrains.kotlin.backend.common.serialization.IrSymbol symbol = 1;</code>
*/
public Builder mergeSymbol(org.jetbrains.kotlin.backend.common.serialization.KotlinIr.IrSymbol value) {
if (((bitField0_ & 0x00000002) == 0x00000002) &&
if (((bitField0_ & 0x00000001) == 0x00000001) &&
symbol_ != org.jetbrains.kotlin.backend.common.serialization.KotlinIr.IrSymbol.getDefaultInstance()) {
symbol_ =
org.jetbrains.kotlin.backend.common.serialization.KotlinIr.IrSymbol.newBuilder(symbol_).mergeFrom(value).buildPartial();
@@ -18256,34 +18095,34 @@ public final class KotlinIr {
symbol_ = value;
}
bitField0_ |= 0x00000002;
bitField0_ |= 0x00000001;
return this;
}
/**
* <code>required .org.jetbrains.kotlin.backend.common.serialization.IrSymbol symbol = 2;</code>
* <code>required .org.jetbrains.kotlin.backend.common.serialization.IrSymbol symbol = 1;</code>
*/
public Builder clearSymbol() {
symbol_ = org.jetbrains.kotlin.backend.common.serialization.KotlinIr.IrSymbol.getDefaultInstance();
bitField0_ = (bitField0_ & ~0x00000002);
bitField0_ = (bitField0_ & ~0x00000001);
return this;
}
private org.jetbrains.kotlin.backend.common.serialization.KotlinIr.MemberAccessCommon memberAccess_ = org.jetbrains.kotlin.backend.common.serialization.KotlinIr.MemberAccessCommon.getDefaultInstance();
/**
* <code>required .org.jetbrains.kotlin.backend.common.serialization.MemberAccessCommon member_access = 3;</code>
* <code>required .org.jetbrains.kotlin.backend.common.serialization.MemberAccessCommon member_access = 2;</code>
*/
public boolean hasMemberAccess() {
return ((bitField0_ & 0x00000004) == 0x00000004);
return ((bitField0_ & 0x00000002) == 0x00000002);
}
/**
* <code>required .org.jetbrains.kotlin.backend.common.serialization.MemberAccessCommon member_access = 3;</code>
* <code>required .org.jetbrains.kotlin.backend.common.serialization.MemberAccessCommon member_access = 2;</code>
*/
public org.jetbrains.kotlin.backend.common.serialization.KotlinIr.MemberAccessCommon getMemberAccess() {
return memberAccess_;
}
/**
* <code>required .org.jetbrains.kotlin.backend.common.serialization.MemberAccessCommon member_access = 3;</code>
* <code>required .org.jetbrains.kotlin.backend.common.serialization.MemberAccessCommon member_access = 2;</code>
*/
public Builder setMemberAccess(org.jetbrains.kotlin.backend.common.serialization.KotlinIr.MemberAccessCommon value) {
if (value == null) {
@@ -18291,24 +18130,24 @@ public final class KotlinIr {
}
memberAccess_ = value;
bitField0_ |= 0x00000004;
bitField0_ |= 0x00000002;
return this;
}
/**
* <code>required .org.jetbrains.kotlin.backend.common.serialization.MemberAccessCommon member_access = 3;</code>
* <code>required .org.jetbrains.kotlin.backend.common.serialization.MemberAccessCommon member_access = 2;</code>
*/
public Builder setMemberAccess(
org.jetbrains.kotlin.backend.common.serialization.KotlinIr.MemberAccessCommon.Builder builderForValue) {
memberAccess_ = builderForValue.build();
bitField0_ |= 0x00000004;
bitField0_ |= 0x00000002;
return this;
}
/**
* <code>required .org.jetbrains.kotlin.backend.common.serialization.MemberAccessCommon member_access = 3;</code>
* <code>required .org.jetbrains.kotlin.backend.common.serialization.MemberAccessCommon member_access = 2;</code>
*/
public Builder mergeMemberAccess(org.jetbrains.kotlin.backend.common.serialization.KotlinIr.MemberAccessCommon value) {
if (((bitField0_ & 0x00000004) == 0x00000004) &&
if (((bitField0_ & 0x00000002) == 0x00000002) &&
memberAccess_ != org.jetbrains.kotlin.backend.common.serialization.KotlinIr.MemberAccessCommon.getDefaultInstance()) {
memberAccess_ =
org.jetbrains.kotlin.backend.common.serialization.KotlinIr.MemberAccessCommon.newBuilder(memberAccess_).mergeFrom(value).buildPartial();
@@ -18316,34 +18155,34 @@ public final class KotlinIr {
memberAccess_ = value;
}
bitField0_ |= 0x00000004;
bitField0_ |= 0x00000002;
return this;
}
/**
* <code>required .org.jetbrains.kotlin.backend.common.serialization.MemberAccessCommon member_access = 3;</code>
* <code>required .org.jetbrains.kotlin.backend.common.serialization.MemberAccessCommon member_access = 2;</code>
*/
public Builder clearMemberAccess() {
memberAccess_ = org.jetbrains.kotlin.backend.common.serialization.KotlinIr.MemberAccessCommon.getDefaultInstance();
bitField0_ = (bitField0_ & ~0x00000004);
bitField0_ = (bitField0_ & ~0x00000002);
return this;
}
private org.jetbrains.kotlin.backend.common.serialization.KotlinIr.IrSymbol super_ = org.jetbrains.kotlin.backend.common.serialization.KotlinIr.IrSymbol.getDefaultInstance();
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.IrSymbol super = 4;</code>
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.IrSymbol super = 3;</code>
*/
public boolean hasSuper() {
return ((bitField0_ & 0x00000008) == 0x00000008);
return ((bitField0_ & 0x00000004) == 0x00000004);
}
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.IrSymbol super = 4;</code>
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.IrSymbol super = 3;</code>
*/
public org.jetbrains.kotlin.backend.common.serialization.KotlinIr.IrSymbol getSuper() {
return super_;
}
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.IrSymbol super = 4;</code>
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.IrSymbol super = 3;</code>
*/
public Builder setSuper(org.jetbrains.kotlin.backend.common.serialization.KotlinIr.IrSymbol value) {
if (value == null) {
@@ -18351,24 +18190,24 @@ public final class KotlinIr {
}
super_ = value;
bitField0_ |= 0x00000008;
bitField0_ |= 0x00000004;
return this;
}
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.IrSymbol super = 4;</code>
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.IrSymbol super = 3;</code>
*/
public Builder setSuper(
org.jetbrains.kotlin.backend.common.serialization.KotlinIr.IrSymbol.Builder builderForValue) {
super_ = builderForValue.build();
bitField0_ |= 0x00000008;
bitField0_ |= 0x00000004;
return this;
}
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.IrSymbol super = 4;</code>
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.IrSymbol super = 3;</code>
*/
public Builder mergeSuper(org.jetbrains.kotlin.backend.common.serialization.KotlinIr.IrSymbol value) {
if (((bitField0_ & 0x00000008) == 0x00000008) &&
if (((bitField0_ & 0x00000004) == 0x00000004) &&
super_ != org.jetbrains.kotlin.backend.common.serialization.KotlinIr.IrSymbol.getDefaultInstance()) {
super_ =
org.jetbrains.kotlin.backend.common.serialization.KotlinIr.IrSymbol.newBuilder(super_).mergeFrom(value).buildPartial();
@@ -18376,34 +18215,34 @@ public final class KotlinIr {
super_ = value;
}
bitField0_ |= 0x00000008;
bitField0_ |= 0x00000004;
return this;
}
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.IrSymbol super = 4;</code>
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.IrSymbol super = 3;</code>
*/
public Builder clearSuper() {
super_ = org.jetbrains.kotlin.backend.common.serialization.KotlinIr.IrSymbol.getDefaultInstance();
bitField0_ = (bitField0_ & ~0x00000008);
bitField0_ = (bitField0_ & ~0x00000004);
return this;
}
private org.jetbrains.kotlin.backend.common.serialization.KotlinIr.IrStatementOrigin origin_ = org.jetbrains.kotlin.backend.common.serialization.KotlinIr.IrStatementOrigin.getDefaultInstance();
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.IrStatementOrigin origin = 5;</code>
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.IrStatementOrigin origin = 4;</code>
*/
public boolean hasOrigin() {
return ((bitField0_ & 0x00000010) == 0x00000010);
return ((bitField0_ & 0x00000008) == 0x00000008);
}
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.IrStatementOrigin origin = 5;</code>
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.IrStatementOrigin origin = 4;</code>
*/
public org.jetbrains.kotlin.backend.common.serialization.KotlinIr.IrStatementOrigin getOrigin() {
return origin_;
}
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.IrStatementOrigin origin = 5;</code>
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.IrStatementOrigin origin = 4;</code>
*/
public Builder setOrigin(org.jetbrains.kotlin.backend.common.serialization.KotlinIr.IrStatementOrigin value) {
if (value == null) {
@@ -18411,24 +18250,24 @@ public final class KotlinIr {
}
origin_ = value;
bitField0_ |= 0x00000010;
bitField0_ |= 0x00000008;
return this;
}
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.IrStatementOrigin origin = 5;</code>
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.IrStatementOrigin origin = 4;</code>
*/
public Builder setOrigin(
org.jetbrains.kotlin.backend.common.serialization.KotlinIr.IrStatementOrigin.Builder builderForValue) {
origin_ = builderForValue.build();
bitField0_ |= 0x00000010;
bitField0_ |= 0x00000008;
return this;
}
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.IrStatementOrigin origin = 5;</code>
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.IrStatementOrigin origin = 4;</code>
*/
public Builder mergeOrigin(org.jetbrains.kotlin.backend.common.serialization.KotlinIr.IrStatementOrigin value) {
if (((bitField0_ & 0x00000010) == 0x00000010) &&
if (((bitField0_ & 0x00000008) == 0x00000008) &&
origin_ != org.jetbrains.kotlin.backend.common.serialization.KotlinIr.IrStatementOrigin.getDefaultInstance()) {
origin_ =
org.jetbrains.kotlin.backend.common.serialization.KotlinIr.IrStatementOrigin.newBuilder(origin_).mergeFrom(value).buildPartial();
@@ -18436,16 +18275,16 @@ public final class KotlinIr {
origin_ = value;
}
bitField0_ |= 0x00000010;
bitField0_ |= 0x00000008;
return this;
}
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.IrStatementOrigin origin = 5;</code>
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.IrStatementOrigin origin = 4;</code>
*/
public Builder clearOrigin() {
origin_ = org.jetbrains.kotlin.backend.common.serialization.KotlinIr.IrStatementOrigin.getDefaultInstance();
bitField0_ = (bitField0_ & ~0x00000010);
bitField0_ = (bitField0_ & ~0x00000008);
return this;
}