Unary operators.
This commit is contained in:
committed by
Dmitry Petrov
parent
97593fa19e
commit
985f3b20c7
@@ -28,7 +28,7 @@ import org.jetbrains.kotlin.resolve.scopes.receivers.*
|
|||||||
import org.jetbrains.kotlin.types.KotlinType
|
import org.jetbrains.kotlin.types.KotlinType
|
||||||
import java.util.*
|
import java.util.*
|
||||||
|
|
||||||
class CallGenerator(statementGenerator: StatementGenerator) : IrChildBodyGeneratorBase<StatementGenerator>(statementGenerator) {
|
class CallGenerator(parentGenerator: StatementGenerator) : IrChildBodyGeneratorBase<StatementGenerator>(parentGenerator) {
|
||||||
fun generateCall(
|
fun generateCall(
|
||||||
ktElement: KtElement,
|
ktElement: KtElement,
|
||||||
resolvedCall: ResolvedCall<out CallableDescriptor>,
|
resolvedCall: ResolvedCall<out CallableDescriptor>,
|
||||||
@@ -94,15 +94,14 @@ class CallGenerator(statementGenerator: StatementGenerator) : IrChildBodyGenerat
|
|||||||
generateCallWithArgumentReordering(irCall, ktElement, resolvedCall, returnType)
|
generateCallWithArgumentReordering(irCall, ktElement, resolvedCall, returnType)
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
irCall.apply {
|
val valueArguments = resolvedCall.valueArgumentsByIndex
|
||||||
val valueArguments = resolvedCall.valueArgumentsByIndex
|
for (index in valueArguments!!.indices) {
|
||||||
for (index in valueArguments!!.indices) {
|
val valueArgument = valueArguments[index]
|
||||||
val valueArgument = valueArguments[index]
|
val valueParameter = descriptor.valueParameters[index]
|
||||||
val valueParameter = descriptor.valueParameters[index]
|
val irArgument = generateValueArgument(valueArgument, valueParameter) ?: continue
|
||||||
val irArgument = generateValueArgument(valueArgument, valueParameter) ?: continue
|
irCall.putArgument(index, irArgument)
|
||||||
irCall.putArgument(index, irArgument)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
irCall
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+47
-11
@@ -16,10 +16,10 @@
|
|||||||
|
|
||||||
package org.jetbrains.kotlin.psi2ir.generators
|
package org.jetbrains.kotlin.psi2ir.generators
|
||||||
|
|
||||||
|
import org.jetbrains.kotlin.descriptors.CallableDescriptor
|
||||||
import org.jetbrains.kotlin.ir.IrStatement
|
import org.jetbrains.kotlin.ir.IrStatement
|
||||||
import org.jetbrains.kotlin.ir.expressions.IrBlockImpl
|
import org.jetbrains.kotlin.ir.assertCast
|
||||||
import org.jetbrains.kotlin.ir.expressions.IrExpression
|
import org.jetbrains.kotlin.ir.expressions.*
|
||||||
import org.jetbrains.kotlin.ir.expressions.IrOperator
|
|
||||||
import org.jetbrains.kotlin.psi.KtElement
|
import org.jetbrains.kotlin.psi.KtElement
|
||||||
import org.jetbrains.kotlin.psi.psiUtil.endOffset
|
import org.jetbrains.kotlin.psi.psiUtil.endOffset
|
||||||
import org.jetbrains.kotlin.psi.psiUtil.startOffset
|
import org.jetbrains.kotlin.psi.psiUtil.startOffset
|
||||||
@@ -42,20 +42,56 @@ class IrBlockBuilder(val startOffset: Int, val endOffset: Int, val irOperator: I
|
|||||||
fun <T : IrExpression> result(irExpression: T): T {
|
fun <T : IrExpression> result(irExpression: T): T {
|
||||||
resultType = irExpression.type
|
resultType = irExpression.type
|
||||||
hasResult = true
|
hasResult = true
|
||||||
|
statements.add(irExpression)
|
||||||
return irExpression
|
return irExpression
|
||||||
}
|
}
|
||||||
|
|
||||||
fun build() =
|
fun build() =
|
||||||
if (statements.size == 1)
|
if (statements.size == 1)
|
||||||
statements[0]
|
statements[0]
|
||||||
else
|
else {
|
||||||
IrBlockImpl(startOffset, endOffset, resultType, hasResult, irOperator).apply {
|
val block = IrBlockImpl(startOffset, endOffset, resultType, hasResult, irOperator)
|
||||||
statements.forEach { addStatement(it) }
|
statements.forEach { block.addStatement(it) }
|
||||||
}
|
block
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun IrBodyGenerator.block(ktElement: KtElement, irOperator: IrOperator, body: IrBlockBuilder.() -> Unit) =
|
fun IrBodyGenerator.block(ktElement: KtElement, irOperator: IrOperator, body: IrBlockBuilder.() -> Unit): IrExpression =
|
||||||
IrBlockBuilder(ktElement.startOffset, ktElement.endOffset, irOperator, this).apply(body).build()
|
IrBlockBuilder(ktElement.startOffset, ktElement.endOffset, irOperator, this).apply(body).build().assertCast()
|
||||||
|
|
||||||
fun IrBodyGenerator.block(irExpression: IrExpression, irOperator: IrOperator, body: IrBlockBuilder.() -> Unit) =
|
fun IrBodyGenerator.block(irExpression: IrExpression, irOperator: IrOperator, body: IrBlockBuilder.() -> Unit): IrExpression =
|
||||||
IrBlockBuilder(irExpression.startOffset, irExpression.endOffset, irOperator, this).apply(body).build()
|
IrBlockBuilder(irExpression.startOffset, irExpression.endOffset, irOperator, this).apply(body).build().assertCast()
|
||||||
|
|
||||||
|
fun IrBlockBuilder.constType(constKind: IrConstKind<*>): KotlinType =
|
||||||
|
when (constKind) {
|
||||||
|
IrConstKind.Null -> generator.context.builtIns.nullableNothingType
|
||||||
|
IrConstKind.Boolean -> generator.context.builtIns.anyType
|
||||||
|
IrConstKind.Byte -> generator.context.builtIns.byteType
|
||||||
|
IrConstKind.Short -> generator.context.builtIns.shortType
|
||||||
|
IrConstKind.Int -> generator.context.builtIns.intType
|
||||||
|
IrConstKind.Long -> generator.context.builtIns.longType
|
||||||
|
IrConstKind.String -> generator.context.builtIns.stringType
|
||||||
|
IrConstKind.Float -> generator.context.builtIns.floatType
|
||||||
|
IrConstKind.Double -> generator.context.builtIns.doubleType
|
||||||
|
}
|
||||||
|
|
||||||
|
fun <T> IrBlockBuilder.const(constKind: IrConstKind<T>, value: T) =
|
||||||
|
IrConstImpl(startOffset, endOffset, constType(constKind), constKind, value)
|
||||||
|
|
||||||
|
fun IrBlockBuilder.constNull() =
|
||||||
|
const(IrConstKind.Null, null)
|
||||||
|
|
||||||
|
fun IrBlockBuilder.op0(operatorDescriptor: CallableDescriptor) =
|
||||||
|
IrNullaryOperatorImpl(startOffset, endOffset, irOperator, operatorDescriptor)
|
||||||
|
|
||||||
|
fun IrBlockBuilder.op1(operatorDescriptor: CallableDescriptor, argument: IrExpression) =
|
||||||
|
IrUnaryOperatorImpl(startOffset, endOffset, irOperator, operatorDescriptor, argument)
|
||||||
|
|
||||||
|
fun IrBlockBuilder.op2(operatorDescriptor: CallableDescriptor, argument1: IrExpression, argument2: IrExpression) =
|
||||||
|
IrBinaryOperatorImpl(startOffset, endOffset, irOperator, operatorDescriptor, argument1, argument2)
|
||||||
|
|
||||||
|
fun IrBlockBuilder.equalsNull(argument: IrExpression) =
|
||||||
|
op2(generator.context.irBuiltIns.eqeq, argument, constNull())
|
||||||
|
|
||||||
|
fun IrBlockBuilder.ifThenElse(type: KotlinType?, condition: IrExpression, thenBranch: IrExpression, elseBranch: IrExpression) =
|
||||||
|
IrIfThenElseImpl(startOffset, endOffset, type, condition, thenBranch, elseBranch, irOperator)
|
||||||
|
|||||||
+13
-6
@@ -27,9 +27,11 @@ interface IrBodyGenerator : IrGenerator {
|
|||||||
val scope: Scope
|
val scope: Scope
|
||||||
}
|
}
|
||||||
|
|
||||||
abstract class IrChildBodyGeneratorBase<out T : IrBodyGenerator>(val parentGenerator: T) : IrBodyGenerator {
|
abstract class IrChildBodyGeneratorBase<out T : IrBodyGenerator>(
|
||||||
|
val parentGenerator: T
|
||||||
|
) : IrBodyGenerator {
|
||||||
override val context: GeneratorContext get() = parentGenerator.context
|
override val context: GeneratorContext get() = parentGenerator.context
|
||||||
override val scope: Scope get() = parentGenerator.scope
|
override val scope: Scope = Scope(parentGenerator.scope)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun IrBodyGenerator.toExpectedType(irExpression: IrExpression, expectedType: KotlinType?): IrExpression {
|
fun IrBodyGenerator.toExpectedType(irExpression: IrExpression, expectedType: KotlinType?): IrExpression {
|
||||||
@@ -41,9 +43,13 @@ fun IrBodyGenerator.toExpectedType(irExpression: IrExpression, expectedType: Kot
|
|||||||
val valueType = irExpression.type ?: throw AssertionError("expectedType != null, valueType == null: $this")
|
val valueType = irExpression.type ?: throw AssertionError("expectedType != null, valueType == null: $this")
|
||||||
|
|
||||||
if (valueType.isNullabilityFlexible() && !expectedType.isMarkedNullable) {
|
if (valueType.isNullabilityFlexible() && !expectedType.isMarkedNullable) {
|
||||||
return IrUnaryOperatorImpl(irExpression.startOffset, irExpression.endOffset, IrOperator.IMPLICIT_NOTNULL,
|
return block(irExpression, IrOperator.IMPLICIT_NOTNULL) {
|
||||||
context.irBuiltIns.implicitNotNull,
|
add(scope.introduceTemporary(irExpression))
|
||||||
irExpression)
|
result(ifThenElse(expectedType,
|
||||||
|
equalsNull(scope.valueOf(irExpression)!!),
|
||||||
|
op0(context.irBuiltIns.throwNpe),
|
||||||
|
scope.valueOf(irExpression)!!))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!KotlinTypeChecker.DEFAULT.isSubtypeOf(valueType, expectedType)) {
|
if (!KotlinTypeChecker.DEFAULT.isSubtypeOf(valueType, expectedType)) {
|
||||||
@@ -58,4 +64,5 @@ fun StatementGenerator.generateExpressionWithExpectedType(ktExpression: KtExpres
|
|||||||
toExpectedType(generateExpression(ktExpression), expectedType)
|
toExpectedType(generateExpression(ktExpression), expectedType)
|
||||||
|
|
||||||
fun IrBodyGenerator.toExpectedTypeOrNull(irExpression: IrExpression?, expectedType: KotlinType?): IrExpression? =
|
fun IrBodyGenerator.toExpectedTypeOrNull(irExpression: IrExpression?, expectedType: KotlinType?): IrExpression? =
|
||||||
irExpression?.let { toExpectedType(it, expectedType) }
|
irExpression?.let { toExpectedType(it, expectedType) }
|
||||||
|
|
||||||
|
|||||||
+60
-21
@@ -25,27 +25,36 @@ import org.jetbrains.kotlin.psi.*
|
|||||||
import org.jetbrains.kotlin.psi.psiUtil.endOffset
|
import org.jetbrains.kotlin.psi.psiUtil.endOffset
|
||||||
import org.jetbrains.kotlin.psi.psiUtil.startOffset
|
import org.jetbrains.kotlin.psi.psiUtil.startOffset
|
||||||
import org.jetbrains.kotlin.psi2ir.defaultLoad
|
import org.jetbrains.kotlin.psi2ir.defaultLoad
|
||||||
|
import org.jetbrains.kotlin.psi2ir.generators.operators.*
|
||||||
import org.jetbrains.kotlin.psi2ir.generators.values.*
|
import org.jetbrains.kotlin.psi2ir.generators.values.*
|
||||||
import org.jetbrains.kotlin.resolve.BindingContext
|
import org.jetbrains.kotlin.resolve.BindingContext
|
||||||
import org.jetbrains.kotlin.resolve.calls.callUtil.isSafeCall
|
import org.jetbrains.kotlin.resolve.calls.callUtil.isSafeCall
|
||||||
import org.jetbrains.kotlin.types.typeUtil.makeNullable
|
import org.jetbrains.kotlin.types.typeUtil.makeNullable
|
||||||
import java.lang.AssertionError
|
|
||||||
|
|
||||||
|
|
||||||
class OperatorExpressionGenerator(statementGenerator: StatementGenerator) : IrChildBodyGeneratorBase<StatementGenerator>(statementGenerator) {
|
|
||||||
|
class OperatorExpressionGenerator(parentGenerator: StatementGenerator) : IrChildBodyGeneratorBase<StatementGenerator>(parentGenerator) {
|
||||||
fun generatePrefixExpression(expression: KtPrefixExpression): IrExpression {
|
fun generatePrefixExpression(expression: KtPrefixExpression): IrExpression {
|
||||||
val ktOperator = expression.operationReference.getReferencedNameElementType()
|
val ktOperator = expression.operationReference.getReferencedNameElementType()
|
||||||
val irOperator = getIrPrefixOperator(ktOperator)
|
val irOperator = getPrefixOperator(ktOperator)
|
||||||
|
|
||||||
return when (irOperator) {
|
return when (irOperator) {
|
||||||
null -> createDummyExpression(expression, ktOperator.toString())
|
null -> throw AssertionError("Unexpected prefix operator: $ktOperator")
|
||||||
in PREFIX_INCREMENT_DECREMENT_OPERATORS -> generatePrefixIncrementDecrementOperator(expression, irOperator)
|
in INCREMENT_DECREMENT_OPERATORS -> generatePrefixIncrementDecrementOperator(expression, irOperator)
|
||||||
|
in OPERATORS_DESUGARED_TO_CALLS -> generatePrefixOperatorAsCall(expression, irOperator)
|
||||||
else -> createDummyExpression(expression, ktOperator.toString())
|
else -> createDummyExpression(expression, ktOperator.toString())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun generatePostfixExpression(expression: KtPostfixExpression): IrExpression {
|
fun generatePostfixExpression(expression: KtPostfixExpression): IrExpression {
|
||||||
TODO("not implemented")
|
val ktOperator = expression.operationReference.getReferencedNameElementType()
|
||||||
|
val irOperator = getPostfixOperator(ktOperator)
|
||||||
|
|
||||||
|
return when (irOperator) {
|
||||||
|
null -> throw AssertionError("Unexpected postfix operator: $ktOperator")
|
||||||
|
in INCREMENT_DECREMENT_OPERATORS -> generatePostfixIncrementDecrementOperator(expression, irOperator)
|
||||||
|
else -> createDummyExpression(expression, ktOperator.toString())
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun generateCastExpression(expression: KtBinaryExpressionWithTypeRHS): IrExpression {
|
fun generateCastExpression(expression: KtBinaryExpressionWithTypeRHS): IrExpression {
|
||||||
@@ -78,17 +87,17 @@ class OperatorExpressionGenerator(statementGenerator: StatementGenerator) : IrCh
|
|||||||
fun generateBinaryExpression(expression: KtBinaryExpression): IrExpression {
|
fun generateBinaryExpression(expression: KtBinaryExpression): IrExpression {
|
||||||
val ktOperator = expression.operationReference.getReferencedNameElementType()
|
val ktOperator = expression.operationReference.getReferencedNameElementType()
|
||||||
if (ktOperator == KtTokens.IDENTIFIER) {
|
if (ktOperator == KtTokens.IDENTIFIER) {
|
||||||
return generateBinaryOperatorWithConventionalCall(expression, null)
|
return generateBinaryOperatorAsCall(expression, null)
|
||||||
}
|
}
|
||||||
|
|
||||||
val irOperator = getIrBinaryOperator(ktOperator)
|
val irOperator = getInfixOperator(ktOperator)
|
||||||
|
|
||||||
return when (irOperator) {
|
return when (irOperator) {
|
||||||
null -> createDummyExpression(expression, ktOperator.toString())
|
null -> throw AssertionError("Unexpected infix operator: $ktOperator")
|
||||||
IrOperator.EQ -> generateAssignment(expression)
|
IrOperator.EQ -> generateAssignment(expression)
|
||||||
IrOperator.ELVIS -> generateElvis(expression)
|
IrOperator.ELVIS -> generateElvis(expression)
|
||||||
in AUGMENTED_ASSIGNMENTS -> generateAugmentedAssignment(expression, irOperator)
|
in AUGMENTED_ASSIGNMENTS -> generateAugmentedAssignment(expression, irOperator)
|
||||||
in BINARY_OPERATORS_DESUGARED_TO_CALLS -> generateBinaryOperatorWithConventionalCall(expression, irOperator)
|
in OPERATORS_DESUGARED_TO_CALLS -> generateBinaryOperatorAsCall(expression, irOperator)
|
||||||
in COMPARISON_OPERATORS -> generateComparisonOperator(expression, irOperator)
|
in COMPARISON_OPERATORS -> generateComparisonOperator(expression, irOperator)
|
||||||
in EQUALITY_OPERATORS -> generateEqualityOperator(expression, irOperator)
|
in EQUALITY_OPERATORS -> generateEqualityOperator(expression, irOperator)
|
||||||
in IDENTITY_OPERATORS -> generateIdentityOperator(expression, irOperator)
|
in IDENTITY_OPERATORS -> generateIdentityOperator(expression, irOperator)
|
||||||
@@ -99,21 +108,22 @@ class OperatorExpressionGenerator(statementGenerator: StatementGenerator) : IrCh
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun generateElvis(expression: KtBinaryExpression): IrExpression {
|
private fun generateElvis(expression: KtBinaryExpression): IrExpression {
|
||||||
// TODO desugar '?:' to 'if'
|
|
||||||
val specialCallForElvis = getResolvedCall(expression)!!
|
val specialCallForElvis = getResolvedCall(expression)!!
|
||||||
val returnType = specialCallForElvis.resultingDescriptor.returnType!!
|
val returnType = specialCallForElvis.resultingDescriptor.returnType!!
|
||||||
val irArgument0 = toExpectedType(parentGenerator.generateExpression(expression.left!!), returnType.makeNullable())
|
val irArgument0 = parentGenerator.generateExpressionWithExpectedType(expression.left!!, returnType.makeNullable())
|
||||||
val irArgument1 = toExpectedType(parentGenerator.generateExpression(expression.right!!), returnType)
|
val irArgument1 = parentGenerator.generateExpressionWithExpectedType(expression.right!!, returnType)
|
||||||
// return IrBinaryOperatorImpl(
|
return block(expression, IrOperator.ELVIS) {
|
||||||
// expression.startOffset, expression.endOffset, returnType,
|
add(scope.introduceTemporary(irArgument0))
|
||||||
// IrOperator.ELVIS, null, irArgument0, irArgument1
|
result(ifThenElse(returnType,
|
||||||
// )
|
equalsNull(scope.valueOf(irArgument0)!!),
|
||||||
return createDummyExpression(expression, "elvis")
|
irArgument1,
|
||||||
|
scope.valueOf(irArgument0)!!))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun generateBinaryBooleanOperator(expression: KtBinaryExpression, irOperator: IrOperator): IrExpression {
|
private fun generateBinaryBooleanOperator(expression: KtBinaryExpression, irOperator: IrOperator): IrExpression {
|
||||||
val irArgument0 = toExpectedType(parentGenerator.generateExpression(expression.left!!), context.builtIns.booleanType)
|
val irArgument0 = parentGenerator.generateExpressionWithExpectedType(expression.left!!, context.builtIns.booleanType)
|
||||||
val irArgument1 = toExpectedType(parentGenerator.generateExpression(expression.right!!), context.builtIns.booleanType)
|
val irArgument1 = parentGenerator.generateExpressionWithExpectedType(expression.right!!, context.builtIns.booleanType)
|
||||||
return when (irOperator) {
|
return when (irOperator) {
|
||||||
IrOperator.OROR ->
|
IrOperator.OROR ->
|
||||||
IrIfThenElseImpl.oror(expression.startOffset, expression.endOffset, irArgument0, irArgument1)
|
IrIfThenElseImpl.oror(expression.startOffset, expression.endOffset, irArgument0, irArgument1)
|
||||||
@@ -198,7 +208,7 @@ class OperatorExpressionGenerator(statementGenerator: StatementGenerator) : IrCh
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private fun generateBinaryOperatorWithConventionalCall(expression: KtBinaryExpression, irOperator: IrOperator?): IrExpression {
|
private fun generateBinaryOperatorAsCall(expression: KtBinaryExpression, irOperator: IrOperator?): IrExpression {
|
||||||
val operatorCall = getResolvedCall(expression)!!
|
val operatorCall = getResolvedCall(expression)!!
|
||||||
return CallGenerator(parentGenerator).generateCall(expression, operatorCall, irOperator)
|
return CallGenerator(parentGenerator).generateCall(expression, operatorCall, irOperator)
|
||||||
}
|
}
|
||||||
@@ -222,6 +232,35 @@ class OperatorExpressionGenerator(statementGenerator: StatementGenerator) : IrCh
|
|||||||
return irBlock
|
return irBlock
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun generatePostfixIncrementDecrementOperator(expression: KtPostfixExpression, irOperator: IrOperator): IrExpression {
|
||||||
|
val ktBaseExpression = expression.baseExpression!!
|
||||||
|
val irLValue = generateLValue(ktBaseExpression, irOperator)
|
||||||
|
val operatorCall = getResolvedCall(expression)!!
|
||||||
|
|
||||||
|
if (irLValue is IrLValueWithAugmentedStore) {
|
||||||
|
return irLValue.postfixAugmentedStore(operatorCall, irOperator)
|
||||||
|
}
|
||||||
|
|
||||||
|
val irBlock = IrBlockImpl(expression.startOffset, expression.endOffset, irLValue.type, true, irOperator)
|
||||||
|
val opCallGenerator = CallGenerator(parentGenerator)
|
||||||
|
|
||||||
|
val irTmp = parentGenerator.scope.createTemporaryVariable(irLValue.load())
|
||||||
|
irBlock.addStatement(irTmp)
|
||||||
|
|
||||||
|
opCallGenerator.scope.putValue(ktBaseExpression, VariableLValue(this, irTmp, irOperator))
|
||||||
|
val irOpCall = opCallGenerator.generateCall(expression, operatorCall, irOperator)
|
||||||
|
irBlock.addStatement(irLValue.store(irOpCall))
|
||||||
|
|
||||||
|
irBlock.addStatement(irTmp.defaultLoad())
|
||||||
|
|
||||||
|
return irBlock
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun generatePrefixOperatorAsCall(expression: KtPrefixExpression, irOperator: IrOperator): IrExpression {
|
||||||
|
val resolvedCall = getResolvedCall(expression)!!
|
||||||
|
return CallGenerator(parentGenerator).generateCall(expression, resolvedCall, irOperator)
|
||||||
|
}
|
||||||
|
|
||||||
private fun generateAugmentedAssignment(expression: KtBinaryExpression, irOperator: IrOperator): IrExpression {
|
private fun generateAugmentedAssignment(expression: KtBinaryExpression, irOperator: IrOperator): IrExpression {
|
||||||
val ktLeft = expression.left!!
|
val ktLeft = expression.left!!
|
||||||
val irLValue = generateLValue(ktLeft, irOperator)
|
val irLValue = generateLValue(ktLeft, irOperator)
|
||||||
|
|||||||
@@ -43,78 +43,82 @@ class Scope private constructor(val scopeOwner: DeclarationDescriptor, val paren
|
|||||||
private var lastTemporaryIndex: Int = parent?.lastTemporaryIndex ?: 0
|
private var lastTemporaryIndex: Int = parent?.lastTemporaryIndex ?: 0
|
||||||
private fun nextTemporaryIndex(): Int = parent?.nextTemporaryIndex() ?: lastTemporaryIndex++
|
private fun nextTemporaryIndex(): Int = parent?.nextTemporaryIndex() ?: lastTemporaryIndex++
|
||||||
|
|
||||||
private val expressionValues = HashMap<KtExpression, IrValue>()
|
private val values = HashMap<Any, IrValue>()
|
||||||
private val receiverValues = HashMap<ReceiverValue, IrValue>()
|
|
||||||
private val valueArgumentValues = HashMap<ValueParameterDescriptor, IrValue>()
|
private inline fun introduceTemporary(irExpression: IrExpression, nameHint: String?, register: (IrValue) -> Unit): IrVariable? {
|
||||||
|
val rematerializable = createRematerializableValue(irExpression)
|
||||||
|
return if (rematerializable != null) {
|
||||||
|
register(rematerializable)
|
||||||
|
null
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
createTemporary(irExpression, nameHint, register)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private inline fun createTemporary(irExpression: IrExpression, nameHint: String?, register: (IrValue) -> Unit): IrVariable {
|
||||||
|
val irTemporary = createTemporaryVariable(irExpression, nameHint)
|
||||||
|
register(VariableLValue(generator, irTemporary))
|
||||||
|
return irTemporary
|
||||||
|
}
|
||||||
|
|
||||||
private fun createDescriptorForTemporaryVariable(type: KotlinType, nameHint: String? = null): IrTemporaryVariableDescriptor =
|
private fun createDescriptorForTemporaryVariable(type: KotlinType, nameHint: String? = null): IrTemporaryVariableDescriptor =
|
||||||
IrTemporaryVariableDescriptorImpl(
|
IrTemporaryVariableDescriptorImpl(scopeOwner, Name.identifier(getNameForTemporary(nameHint)), type)
|
||||||
scopeOwner,
|
|
||||||
Name.identifier(
|
private fun getNameForTemporary(nameHint: String?): String {
|
||||||
if (nameHint != null)
|
val index = nextTemporaryIndex()
|
||||||
"tmp${nextTemporaryIndex()}_$nameHint"
|
return if (nameHint != null) "tmp${index}_$nameHint" else "tmp$index"
|
||||||
else
|
}
|
||||||
"tmp${nextTemporaryIndex()}"
|
|
||||||
),
|
|
||||||
type)
|
|
||||||
|
|
||||||
fun createTemporaryVariable(irExpression: IrExpression, nameHint: String? = null): IrVariable =
|
fun createTemporaryVariable(irExpression: IrExpression, nameHint: String? = null): IrVariable =
|
||||||
IrVariableImpl(irExpression.startOffset, irExpression.endOffset, IrDeclarationOriginKind.IR_TEMPORARY_VARIABLE,
|
IrVariableImpl(
|
||||||
createDescriptorForTemporaryVariable(
|
irExpression.startOffset, irExpression.endOffset, IrDeclarationOriginKind.IR_TEMPORARY_VARIABLE,
|
||||||
irExpression.type ?: throw AssertionError("No type for $irExpression"),
|
createDescriptorForTemporaryVariable(
|
||||||
nameHint
|
irExpression.type ?: throw AssertionError("No type for $irExpression"),
|
||||||
),
|
nameHint
|
||||||
irExpression)
|
),
|
||||||
|
irExpression
|
||||||
|
)
|
||||||
|
|
||||||
fun introduceTemporary(ktExpression: KtExpression, irExpression: IrExpression, nameHint: String? = null): IrVariable? {
|
fun introduceTemporary(ktExpression: KtExpression, irExpression: IrExpression, nameHint: String? = null): IrVariable? =
|
||||||
val rematerializable = createRematerializableValue(irExpression)
|
introduceTemporary(irExpression, nameHint) { putValue(ktExpression, it) }
|
||||||
if (rematerializable != null) {
|
|
||||||
putValue(ktExpression, rematerializable)
|
|
||||||
return null
|
|
||||||
}
|
|
||||||
|
|
||||||
return createTemporary(ktExpression, irExpression, nameHint)
|
fun introduceTemporary(valueParameterDescriptor: ValueParameterDescriptor, irExpression: IrExpression): IrVariable? =
|
||||||
}
|
introduceTemporary(irExpression, valueParameterDescriptor.name.asString()) { putValue(valueParameterDescriptor, it) }
|
||||||
|
|
||||||
fun createTemporary(ktExpression: KtExpression, irExpression: IrExpression, nameHint: String?): IrVariable {
|
fun introduceTemporary(irExpression: IrExpression): IrVariable? =
|
||||||
val irTmpVar = createTemporaryVariable(irExpression, nameHint)
|
introduceTemporary(irExpression, null) { putValue(irExpression, it) }
|
||||||
putValue(ktExpression, VariableLValue(generator, irTmpVar))
|
|
||||||
return irTmpVar
|
|
||||||
}
|
|
||||||
|
|
||||||
fun createTemporary(irExpression: IrExpression, nameHint: String?): IrVariable =
|
fun createTemporary(ktExpression: KtExpression, irExpression: IrExpression, nameHint: String?): IrVariable =
|
||||||
createTemporaryVariable(irExpression, nameHint)
|
createTemporary(irExpression, nameHint) { putValue(ktExpression, it) }
|
||||||
|
|
||||||
fun introduceTemporary(valueParameterDescriptor: ValueParameterDescriptor, irExpression: IrExpression): IrVariable? {
|
|
||||||
val rematerializable = createRematerializableValue(irExpression)
|
|
||||||
if (rematerializable != null) {
|
|
||||||
putValue(valueParameterDescriptor, rematerializable)
|
|
||||||
return null
|
|
||||||
}
|
|
||||||
|
|
||||||
val irTmpVar = createTemporaryVariable(irExpression, valueParameterDescriptor.name.asString())
|
|
||||||
putValue(valueParameterDescriptor, VariableLValue(generator, irTmpVar))
|
|
||||||
return irTmpVar
|
|
||||||
}
|
|
||||||
|
|
||||||
fun putValue(ktExpression: KtExpression, irValue: IrValue) {
|
fun putValue(ktExpression: KtExpression, irValue: IrValue) {
|
||||||
expressionValues[ktExpression] = irValue
|
values[ktExpression] = irValue
|
||||||
}
|
}
|
||||||
|
|
||||||
fun putValue(receiver: ReceiverValue, irValue: IrValue) {
|
fun putValue(receiver: ReceiverValue, irValue: IrValue) {
|
||||||
receiverValues[receiver] = irValue
|
values[receiver] = irValue
|
||||||
}
|
}
|
||||||
|
|
||||||
fun putValue(parameter: ValueParameterDescriptor, irValue: IrValue) {
|
fun putValue(parameter: ValueParameterDescriptor, irValue: IrValue) {
|
||||||
valueArgumentValues[parameter] = irValue
|
values[parameter] = irValue
|
||||||
|
}
|
||||||
|
|
||||||
|
fun putValue(irExpression: IrExpression, irValue: IrValue) {
|
||||||
|
values[irExpression] = irValue
|
||||||
}
|
}
|
||||||
|
|
||||||
fun valueOf(ktExpression: KtExpression): IrExpression? =
|
fun valueOf(ktExpression: KtExpression): IrExpression? =
|
||||||
expressionValues[ktExpression]?.load() ?: parent?.valueOf(ktExpression)
|
values[ktExpression]?.load() ?: parent?.valueOf(ktExpression)
|
||||||
|
|
||||||
fun valueOf(receiver: ReceiverValue): IrExpression? =
|
fun valueOf(receiver: ReceiverValue): IrExpression? =
|
||||||
receiverValues[receiver]?.load() ?: parent?.valueOf(receiver)
|
values[receiver]?.load() ?: parent?.valueOf(receiver)
|
||||||
|
|
||||||
fun valueOf(parameter: ValueParameterDescriptor): IrExpression? =
|
fun valueOf(parameter: ValueParameterDescriptor): IrExpression? =
|
||||||
valueArgumentValues[parameter]?.load() ?: parent?.valueOf(parameter)
|
values[parameter]?.load() ?: parent?.valueOf(parameter)
|
||||||
|
|
||||||
|
fun valueOf(irExpression: IrExpression): IrExpression? =
|
||||||
|
values[irExpression]?.load() ?: parent?.valueOf(irExpression)
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
fun rootScope(scopeOwner: DeclarationDescriptor, generator: IrBodyGenerator): Scope {
|
fun rootScope(scopeOwner: DeclarationDescriptor, generator: IrBodyGenerator): Scope {
|
||||||
|
|||||||
+7
-3
@@ -33,6 +33,7 @@ import org.jetbrains.kotlin.resolve.DescriptorUtils
|
|||||||
import org.jetbrains.kotlin.resolve.calls.model.ResolvedCall
|
import org.jetbrains.kotlin.resolve.calls.model.ResolvedCall
|
||||||
import org.jetbrains.kotlin.resolve.calls.model.VariableAsFunctionResolvedCall
|
import org.jetbrains.kotlin.resolve.calls.model.VariableAsFunctionResolvedCall
|
||||||
import org.jetbrains.kotlin.resolve.calls.util.FakeCallableDescriptorForObject
|
import org.jetbrains.kotlin.resolve.calls.util.FakeCallableDescriptorForObject
|
||||||
|
import org.jetbrains.kotlin.resolve.constants.BooleanValue
|
||||||
import org.jetbrains.kotlin.resolve.constants.IntValue
|
import org.jetbrains.kotlin.resolve.constants.IntValue
|
||||||
import org.jetbrains.kotlin.resolve.constants.NullValue
|
import org.jetbrains.kotlin.resolve.constants.NullValue
|
||||||
import org.jetbrains.kotlin.resolve.constants.StringValue
|
import org.jetbrains.kotlin.resolve.constants.StringValue
|
||||||
@@ -40,6 +41,7 @@ import org.jetbrains.kotlin.resolve.constants.evaluate.ConstantExpressionEvaluat
|
|||||||
import org.jetbrains.kotlin.resolve.descriptorUtil.classValueType
|
import org.jetbrains.kotlin.resolve.descriptorUtil.classValueType
|
||||||
import org.jetbrains.kotlin.types.expressions.ExpressionTypingUtils
|
import org.jetbrains.kotlin.types.expressions.ExpressionTypingUtils
|
||||||
import org.jetbrains.kotlin.utils.SmartList
|
import org.jetbrains.kotlin.utils.SmartList
|
||||||
|
import org.jetbrains.kotlin.utils.addToStdlib.constant
|
||||||
|
|
||||||
class StatementGenerator(
|
class StatementGenerator(
|
||||||
override val context: GeneratorContext,
|
override val context: GeneratorContext,
|
||||||
@@ -145,6 +147,8 @@ class StatementGenerator(
|
|||||||
IrConstImpl.int(expression.startOffset, expression.endOffset, constantType, constantValue.value)
|
IrConstImpl.int(expression.startOffset, expression.endOffset, constantType, constantValue.value)
|
||||||
is NullValue ->
|
is NullValue ->
|
||||||
IrConstImpl.constNull(expression.startOffset, expression.endOffset, constantType)
|
IrConstImpl.constNull(expression.startOffset, expression.endOffset, constantType)
|
||||||
|
is BooleanValue ->
|
||||||
|
IrConstImpl.boolean(expression.startOffset, expression.endOffset, constantType, constantValue.value)
|
||||||
else ->
|
else ->
|
||||||
TODO("handle other literal types: ${constantValue.type}")
|
TODO("handle other literal types: ${constantValue.type}")
|
||||||
}
|
}
|
||||||
@@ -171,7 +175,7 @@ class StatementGenerator(
|
|||||||
IrConstImpl.string(entry.startOffset, entry.endOffset, context.builtIns.stringType, entry.text)
|
IrConstImpl.string(entry.startOffset, entry.endOffset, context.builtIns.stringType, entry.text)
|
||||||
|
|
||||||
override fun visitSimpleNameExpression(expression: KtSimpleNameExpression, data: Nothing?): IrExpression {
|
override fun visitSimpleNameExpression(expression: KtSimpleNameExpression, data: Nothing?): IrExpression {
|
||||||
val resolvedCall = getResolvedCall(expression)!!
|
val resolvedCall = getResolvedCall(expression) ?: throw AssertionError("No resolved call for ${expression.text}")
|
||||||
|
|
||||||
if (resolvedCall is VariableAsFunctionResolvedCall) {
|
if (resolvedCall is VariableAsFunctionResolvedCall) {
|
||||||
TODO("Unexpected VariableAsFunctionResolvedCall")
|
TODO("Unexpected VariableAsFunctionResolvedCall")
|
||||||
@@ -271,8 +275,8 @@ class StatementGenerator(
|
|||||||
var irElseBranch: IrExpression? = null
|
var irElseBranch: IrExpression? = null
|
||||||
|
|
||||||
whenBranches@while (true) {
|
whenBranches@while (true) {
|
||||||
val irCondition = generateExpressionWithExpectedType(expression.condition!!, context.builtIns.booleanType)
|
val irCondition = generateExpressionWithExpectedType(ktLastIf.condition!!, context.builtIns.booleanType)
|
||||||
val irThenBranch = generateExpressionWithExpectedType(expression.then!!, resultType)
|
val irThenBranch = generateExpressionWithExpectedType(ktLastIf.then!!, resultType)
|
||||||
irBranches.add(Pair(irCondition, irThenBranch))
|
irBranches.add(Pair(irCondition, irThenBranch))
|
||||||
|
|
||||||
val ktElse = ktLastIf.`else`?.deparenthesize()
|
val ktElse = ktLastIf.`else`?.deparenthesize()
|
||||||
|
|||||||
+4
-3
@@ -22,10 +22,11 @@ import org.jetbrains.kotlin.psi.*
|
|||||||
import org.jetbrains.kotlin.psi.psiUtil.endOffset
|
import org.jetbrains.kotlin.psi.psiUtil.endOffset
|
||||||
import org.jetbrains.kotlin.psi.psiUtil.startOffset
|
import org.jetbrains.kotlin.psi.psiUtil.startOffset
|
||||||
import org.jetbrains.kotlin.psi2ir.defaultLoad
|
import org.jetbrains.kotlin.psi2ir.defaultLoad
|
||||||
|
import org.jetbrains.kotlin.psi2ir.generators.operators.getInfixOperator
|
||||||
import org.jetbrains.kotlin.resolve.BindingContext
|
import org.jetbrains.kotlin.resolve.BindingContext
|
||||||
import java.util.*
|
import java.lang.AssertionError
|
||||||
|
|
||||||
class WhenExpressionGenerator(statementGenerator: StatementGenerator) : IrChildBodyGeneratorBase<StatementGenerator>(statementGenerator) {
|
class WhenExpressionGenerator(parentGenerator: StatementGenerator) : IrChildBodyGeneratorBase<StatementGenerator>(parentGenerator) {
|
||||||
fun generate(expression: KtWhenExpression): IrExpression {
|
fun generate(expression: KtWhenExpression): IrExpression {
|
||||||
val conditionsGenerator = CallGenerator(parentGenerator)
|
val conditionsGenerator = CallGenerator(parentGenerator)
|
||||||
|
|
||||||
@@ -114,7 +115,7 @@ class WhenExpressionGenerator(statementGenerator: StatementGenerator) : IrChildB
|
|||||||
|
|
||||||
private fun generateInRangeCondition(conditionsGenerator: CallGenerator, ktCondition: KtWhenConditionInRange): IrExpression {
|
private fun generateInRangeCondition(conditionsGenerator: CallGenerator, ktCondition: KtWhenConditionInRange): IrExpression {
|
||||||
val inResolvedCall = getResolvedCall(ktCondition.operationReference)!!
|
val inResolvedCall = getResolvedCall(ktCondition.operationReference)!!
|
||||||
val inOperator = getIrBinaryOperator(ktCondition.operationReference.getReferencedNameElementType())
|
val inOperator = getInfixOperator(ktCondition.operationReference.getReferencedNameElementType())
|
||||||
val irInCall = conditionsGenerator.generateCall(ktCondition, inResolvedCall, inOperator)
|
val irInCall = conditionsGenerator.generateCall(ktCondition, inResolvedCall, inOperator)
|
||||||
return when (inOperator) {
|
return when (inOperator) {
|
||||||
IrOperator.IN -> irInCall
|
IrOperator.IN -> irInCall
|
||||||
|
|||||||
+10
-8
@@ -14,7 +14,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.jetbrains.kotlin.psi2ir.generators
|
package org.jetbrains.kotlin.psi2ir.generators.operators
|
||||||
|
|
||||||
import com.intellij.psi.tree.IElementType
|
import com.intellij.psi.tree.IElementType
|
||||||
import org.jetbrains.kotlin.ir.expressions.IrOperator
|
import org.jetbrains.kotlin.ir.expressions.IrOperator
|
||||||
@@ -22,7 +22,7 @@ import org.jetbrains.kotlin.ir.expressions.IrTypeOperator
|
|||||||
import org.jetbrains.kotlin.lexer.KtTokens
|
import org.jetbrains.kotlin.lexer.KtTokens
|
||||||
|
|
||||||
|
|
||||||
fun getIrBinaryOperator(ktOperator: IElementType): IrOperator? =
|
fun getInfixOperator(ktOperator: IElementType): IrOperator? =
|
||||||
when (ktOperator) {
|
when (ktOperator) {
|
||||||
KtTokens.EQ -> IrOperator.EQ
|
KtTokens.EQ -> IrOperator.EQ
|
||||||
KtTokens.PLUSEQ -> IrOperator.PLUSEQ
|
KtTokens.PLUSEQ -> IrOperator.PLUSEQ
|
||||||
@@ -52,16 +52,17 @@ fun getIrBinaryOperator(ktOperator: IElementType): IrOperator? =
|
|||||||
else -> null
|
else -> null
|
||||||
}
|
}
|
||||||
|
|
||||||
fun getIrPrefixOperator(ktOperator: IElementType): IrOperator? =
|
fun getPrefixOperator(ktOperator: IElementType): IrOperator? =
|
||||||
when (ktOperator) {
|
when (ktOperator) {
|
||||||
KtTokens.PLUSPLUS -> IrOperator.PREFIX_INCR
|
KtTokens.PLUSPLUS -> IrOperator.PREFIX_INCR
|
||||||
KtTokens.MINUSMINUS -> IrOperator.PREFIX_DECR
|
KtTokens.MINUSMINUS -> IrOperator.PREFIX_DECR
|
||||||
KtTokens.EXCL -> IrOperator.EXCL
|
KtTokens.EXCL -> IrOperator.EXCL
|
||||||
KtTokens.MINUS -> IrOperator.UMINUS
|
KtTokens.MINUS -> IrOperator.UMINUS
|
||||||
|
KtTokens.PLUS -> IrOperator.UPLUS
|
||||||
else -> null
|
else -> null
|
||||||
}
|
}
|
||||||
|
|
||||||
fun getIrPostfixOperator(ktOperator: IElementType): IrOperator? =
|
fun getPostfixOperator(ktOperator: IElementType): IrOperator? =
|
||||||
when (ktOperator) {
|
when (ktOperator) {
|
||||||
KtTokens.PLUSPLUS -> IrOperator.POSTFIX_INCR
|
KtTokens.PLUSPLUS -> IrOperator.POSTFIX_INCR
|
||||||
KtTokens.MINUSMINUS -> IrOperator.POSTFIX_DECR
|
KtTokens.MINUSMINUS -> IrOperator.POSTFIX_DECR
|
||||||
@@ -81,8 +82,9 @@ fun getIrTypeOperator(ktOperator: IElementType): IrTypeOperator? =
|
|||||||
val AUGMENTED_ASSIGNMENTS =
|
val AUGMENTED_ASSIGNMENTS =
|
||||||
setOf(IrOperator.PLUSEQ, IrOperator.MINUSEQ, IrOperator.MULTEQ, IrOperator.DIVEQ, IrOperator.PERCEQ)
|
setOf(IrOperator.PLUSEQ, IrOperator.MINUSEQ, IrOperator.MULTEQ, IrOperator.DIVEQ, IrOperator.PERCEQ)
|
||||||
|
|
||||||
val BINARY_OPERATORS_DESUGARED_TO_CALLS =
|
val OPERATORS_DESUGARED_TO_CALLS =
|
||||||
setOf(IrOperator.PLUS, IrOperator.MINUS, IrOperator.MUL, IrOperator.DIV, IrOperator.PERC, IrOperator.RANGE)
|
setOf(IrOperator.PLUS, IrOperator.MINUS, IrOperator.MUL, IrOperator.DIV, IrOperator.PERC, IrOperator.RANGE,
|
||||||
|
IrOperator.EXCL, IrOperator.UMINUS, IrOperator.UPLUS)
|
||||||
|
|
||||||
val COMPARISON_OPERATORS =
|
val COMPARISON_OPERATORS =
|
||||||
setOf(IrOperator.LT, IrOperator.LTEQ, IrOperator.GT, IrOperator.GTEQ)
|
setOf(IrOperator.LT, IrOperator.LTEQ, IrOperator.GT, IrOperator.GTEQ)
|
||||||
@@ -99,8 +101,8 @@ val IN_OPERATORS =
|
|||||||
val BINARY_BOOLEAN_OPERATORS =
|
val BINARY_BOOLEAN_OPERATORS =
|
||||||
setOf(IrOperator.ANDAND, IrOperator.OROR)
|
setOf(IrOperator.ANDAND, IrOperator.OROR)
|
||||||
|
|
||||||
val PREFIX_INCREMENT_DECREMENT_OPERATORS =
|
val INCREMENT_DECREMENT_OPERATORS =
|
||||||
setOf(IrOperator.PREFIX_INCR, IrOperator.PREFIX_DECR)
|
setOf(IrOperator.PREFIX_INCR, IrOperator.PREFIX_DECR, IrOperator.POSTFIX_INCR, IrOperator.POSTFIX_DECR)
|
||||||
|
|
||||||
val POSTFIX_INCREMENT_DECREMENT_OPERATORS =
|
val POSTFIX_INCREMENT_DECREMENT_OPERATORS =
|
||||||
setOf(IrOperator.POSTFIX_INCR, IrOperator.POSTFIX_DECR)
|
setOf(IrOperator.POSTFIX_INCR, IrOperator.POSTFIX_DECR)
|
||||||
+37
-13
@@ -29,7 +29,7 @@ import org.jetbrains.kotlin.resolve.calls.model.ResolvedCall
|
|||||||
import org.jetbrains.kotlin.types.KotlinType
|
import org.jetbrains.kotlin.types.KotlinType
|
||||||
|
|
||||||
class IndexedLValue(
|
class IndexedLValue(
|
||||||
var statementGenerator: StatementGenerator,
|
val statementGenerator: StatementGenerator,
|
||||||
val ktArrayAccessExpression: KtArrayAccessExpression,
|
val ktArrayAccessExpression: KtArrayAccessExpression,
|
||||||
val irOperator: IrOperator?,
|
val irOperator: IrOperator?,
|
||||||
val irArray: IrExpression,
|
val irArray: IrExpression,
|
||||||
@@ -55,7 +55,7 @@ class IndexedLValue(
|
|||||||
setupCallGeneratorContext(callGenerator.scope)
|
setupCallGeneratorContext(callGenerator.scope)
|
||||||
|
|
||||||
if (irArgument != null) {
|
if (irArgument != null) {
|
||||||
callGenerator.scope.putValue(call.resultingDescriptor.valueParameters.last(), IrSingleExpressionValue(irArgument))
|
callGenerator.scope.putValue(call.resultingDescriptor.valueParameters.last(), SingleExpressionValue(irArgument))
|
||||||
}
|
}
|
||||||
|
|
||||||
return callGenerator.generateCall(ktArrayAccessExpression, call, irOperator)
|
return callGenerator.generateCall(ktArrayAccessExpression, call, irOperator)
|
||||||
@@ -70,14 +70,14 @@ class IndexedLValue(
|
|||||||
val irBlock = createDesugaredBlockWithTemporaries(indexedSetCall, callGenerator, true, irOperator)
|
val irBlock = createDesugaredBlockWithTemporaries(indexedSetCall, callGenerator, true, irOperator)
|
||||||
|
|
||||||
val operatorCallReceiver = operatorCall.extensionReceiver ?: operatorCall.dispatchReceiver
|
val operatorCallReceiver = operatorCall.extensionReceiver ?: operatorCall.dispatchReceiver
|
||||||
callGenerator.scope.putValue(operatorCallReceiver!!,
|
val irGetCall = callGenerator.generateCall(ktArrayAccessExpression, indexedGetCall, irOperator)
|
||||||
IrSingleExpressionValue(callGenerator.generateCall(ktArrayAccessExpression, indexedGetCall, irOperator)))
|
callGenerator.scope.putValue(operatorCallReceiver!!, SingleExpressionValue(irGetCall))
|
||||||
val irTmp = statementGenerator.scope.createTemporaryVariable(
|
|
||||||
callGenerator.generateCall(ktArrayAccessExpression, operatorCall, irOperator))
|
val irOpCall = callGenerator.generateCall(ktArrayAccessExpression, operatorCall, irOperator)
|
||||||
|
val irTmp = callGenerator.scope.createTemporaryVariable(irOpCall)
|
||||||
irBlock.addStatement(irTmp)
|
irBlock.addStatement(irTmp)
|
||||||
|
|
||||||
callGenerator.scope.putValue(indexedSetCall.resultingDescriptor.valueParameters.last(),
|
callGenerator.scope.putValue(indexedSetCall.resultingDescriptor.valueParameters.last(), VariableLValue(callGenerator, irTmp))
|
||||||
VariableLValue(statementGenerator, irTmp))
|
|
||||||
|
|
||||||
irBlock.addStatement(callGenerator.generateCall(ktArrayAccessExpression, indexedSetCall, irOperator))
|
irBlock.addStatement(callGenerator.generateCall(ktArrayAccessExpression, indexedSetCall, irOperator))
|
||||||
|
|
||||||
@@ -86,6 +86,30 @@ class IndexedLValue(
|
|||||||
return irBlock
|
return irBlock
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun postfixAugmentedStore(operatorCall: ResolvedCall<*>, irOperator: IrOperator): IrExpression {
|
||||||
|
if (indexedGetCall == null) throw AssertionError("Indexed LValue has no 'get' call: ${ktArrayAccessExpression.text}")
|
||||||
|
if (indexedSetCall == null) throw AssertionError("Indexed LValue has no 'set' call: ${ktArrayAccessExpression.text}")
|
||||||
|
|
||||||
|
val callGenerator = CallGenerator(statementGenerator)
|
||||||
|
|
||||||
|
val irBlock = createDesugaredBlockWithTemporaries(indexedSetCall, callGenerator, true, irOperator)
|
||||||
|
|
||||||
|
val irGetCall = callGenerator.generateCall(ktArrayAccessExpression, indexedGetCall, irOperator)
|
||||||
|
val irTmp = callGenerator.scope.createTemporaryVariable(irGetCall)
|
||||||
|
irBlock.addStatement(irTmp)
|
||||||
|
|
||||||
|
val operatorCallReceiver = operatorCall.extensionReceiver ?: operatorCall.dispatchReceiver
|
||||||
|
callGenerator.scope.putValue(operatorCallReceiver!!, VariableLValue(callGenerator, irTmp))
|
||||||
|
val irOpCall = callGenerator.generateCall(ktArrayAccessExpression, operatorCall, irOperator)
|
||||||
|
callGenerator.scope.putValue(indexedSetCall.resultingDescriptor.valueParameters.last(), SingleExpressionValue(irOpCall))
|
||||||
|
val irSetCall = callGenerator.generateCall(ktArrayAccessExpression, indexedSetCall, irOperator)
|
||||||
|
irBlock.addStatement(irSetCall)
|
||||||
|
|
||||||
|
irBlock.addStatement(irTmp.defaultLoad())
|
||||||
|
|
||||||
|
return irBlock
|
||||||
|
}
|
||||||
|
|
||||||
override fun augmentedStore(operatorCall: ResolvedCall<*>, irOperator: IrOperator, irOperatorArgument: IrExpression): IrExpression {
|
override fun augmentedStore(operatorCall: ResolvedCall<*>, irOperator: IrOperator, irOperatorArgument: IrExpression): IrExpression {
|
||||||
if (indexedGetCall == null) throw AssertionError("Indexed LValue has no 'get' call: ${ktArrayAccessExpression.text}")
|
if (indexedGetCall == null) throw AssertionError("Indexed LValue has no 'get' call: ${ktArrayAccessExpression.text}")
|
||||||
if (indexedSetCall == null) throw AssertionError("Indexed LValue has no 'set' call: ${ktArrayAccessExpression.text}")
|
if (indexedSetCall == null) throw AssertionError("Indexed LValue has no 'set' call: ${ktArrayAccessExpression.text}")
|
||||||
@@ -94,14 +118,14 @@ class IndexedLValue(
|
|||||||
|
|
||||||
val irBlock = createDesugaredBlockWithTemporaries(indexedSetCall, callGenerator, false, irOperator)
|
val irBlock = createDesugaredBlockWithTemporaries(indexedSetCall, callGenerator, false, irOperator)
|
||||||
|
|
||||||
callGenerator.scope.putValue(operatorCall.resultingDescriptor.valueParameters[0], IrSingleExpressionValue(irOperatorArgument))
|
callGenerator.scope.putValue(operatorCall.resultingDescriptor.valueParameters[0], SingleExpressionValue(irOperatorArgument))
|
||||||
|
|
||||||
val operatorCallReceiver = operatorCall.extensionReceiver ?: operatorCall.dispatchReceiver
|
val operatorCallReceiver = operatorCall.extensionReceiver ?: operatorCall.dispatchReceiver
|
||||||
callGenerator.scope.putValue(operatorCallReceiver!!,
|
callGenerator.scope.putValue(operatorCallReceiver!!,
|
||||||
IrSingleExpressionValue(callGenerator.generateCall(ktArrayAccessExpression, indexedGetCall, irOperator)))
|
SingleExpressionValue(callGenerator.generateCall(ktArrayAccessExpression, indexedGetCall, irOperator)))
|
||||||
|
|
||||||
callGenerator.scope.putValue(indexedSetCall.resultingDescriptor.valueParameters.last(),
|
callGenerator.scope.putValue(indexedSetCall.resultingDescriptor.valueParameters.last(),
|
||||||
IrSingleExpressionValue(callGenerator.generateCall(ktArrayAccessExpression, operatorCall, irOperator)))
|
SingleExpressionValue(callGenerator.generateCall(ktArrayAccessExpression, operatorCall, irOperator)))
|
||||||
|
|
||||||
irBlock.addStatement(callGenerator.generateCall(ktArrayAccessExpression, indexedSetCall, irOperator))
|
irBlock.addStatement(callGenerator.generateCall(ktArrayAccessExpression, indexedSetCall, irOperator))
|
||||||
|
|
||||||
@@ -135,10 +159,10 @@ class IndexedLValue(
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun setupCallGeneratorContext(scope: Scope) {
|
private fun setupCallGeneratorContext(scope: Scope) {
|
||||||
scope.putValue(ktArrayAccessExpression.arrayExpression!!, IrSingleExpressionValue(irArray))
|
scope.putValue(ktArrayAccessExpression.arrayExpression!!, SingleExpressionValue(irArray))
|
||||||
|
|
||||||
for ((ktIndexExpression, irIndexValue) in indexValues) {
|
for ((ktIndexExpression, irIndexValue) in indexValues) {
|
||||||
scope.putValue(ktIndexExpression, IrSingleExpressionValue(irIndexValue))
|
scope.putValue(ktIndexExpression, SingleExpressionValue(irIndexValue))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -27,7 +27,7 @@ interface IrValue {
|
|||||||
val type: KotlinType?
|
val type: KotlinType?
|
||||||
}
|
}
|
||||||
|
|
||||||
class IrSingleExpressionValue(val irExpression: IrExpression) : IrValue {
|
class SingleExpressionValue(val irExpression: IrExpression) : IrValue {
|
||||||
init {
|
init {
|
||||||
irExpression.assertDetached()
|
irExpression.assertDetached()
|
||||||
}
|
}
|
||||||
@@ -50,6 +50,7 @@ interface IrLValue : IrValue {
|
|||||||
}
|
}
|
||||||
|
|
||||||
interface IrLValueWithAugmentedStore : IrLValue {
|
interface IrLValueWithAugmentedStore : IrLValue {
|
||||||
|
fun postfixAugmentedStore(operatorCall: ResolvedCall<*>, irOperator: IrOperator): IrExpression
|
||||||
fun prefixAugmentedStore(operatorCall: ResolvedCall<*>, irOperator: IrOperator): IrExpression
|
fun prefixAugmentedStore(operatorCall: ResolvedCall<*>, irOperator: IrOperator): IrExpression
|
||||||
fun augmentedStore(operatorCall: ResolvedCall<*>, irOperator: IrOperator, irOperatorArgument: IrExpression): IrExpression
|
fun augmentedStore(operatorCall: ResolvedCall<*>, irOperator: IrOperator, irOperatorArgument: IrExpression): IrExpression
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,24 +20,24 @@ import org.jetbrains.kotlin.ir.visitors.IrElementVisitor
|
|||||||
import org.jetbrains.kotlin.types.KotlinType
|
import org.jetbrains.kotlin.types.KotlinType
|
||||||
|
|
||||||
interface IrConst<out T> : IrExpression {
|
interface IrConst<out T> : IrExpression {
|
||||||
val kind: IrLiteralKind<T>
|
val kind: IrConstKind<T>
|
||||||
val value: T
|
val value: T
|
||||||
}
|
}
|
||||||
|
|
||||||
sealed class IrLiteralKind<out T>(val asString: kotlin.String) {
|
sealed class IrConstKind<out T>(val asString: kotlin.String) {
|
||||||
@Suppress("UNCHECKED_CAST")
|
@Suppress("UNCHECKED_CAST")
|
||||||
fun valueOf(aConst: IrConst<*>) =
|
fun valueOf(aConst: IrConst<*>) =
|
||||||
(aConst as IrConst<T>).value
|
(aConst as IrConst<T>).value
|
||||||
|
|
||||||
object Null : IrLiteralKind<Nothing?>("Null")
|
object Null : IrConstKind<Nothing?>("Null")
|
||||||
object Boolean : IrLiteralKind<kotlin.Boolean>("Boolean")
|
object Boolean : IrConstKind<kotlin.Boolean>("Boolean")
|
||||||
object Byte : IrLiteralKind<kotlin.Byte>("Byte")
|
object Byte : IrConstKind<kotlin.Byte>("Byte")
|
||||||
object Short : IrLiteralKind<kotlin.Short>("Short")
|
object Short : IrConstKind<kotlin.Short>("Short")
|
||||||
object Int : IrLiteralKind<kotlin.Int>("Int")
|
object Int : IrConstKind<kotlin.Int>("Int")
|
||||||
object Long : IrLiteralKind<kotlin.Long>("Long")
|
object Long : IrConstKind<kotlin.Long>("Long")
|
||||||
object String : IrLiteralKind<kotlin.String>("String")
|
object String : IrConstKind<kotlin.String>("String")
|
||||||
object Float : IrLiteralKind<kotlin.Float>("Float")
|
object Float : IrConstKind<kotlin.Float>("Float")
|
||||||
object Double : IrLiteralKind<kotlin.Double>("Double")
|
object Double : IrConstKind<kotlin.Double>("Double")
|
||||||
|
|
||||||
override fun toString() = asString
|
override fun toString() = asString
|
||||||
}
|
}
|
||||||
@@ -46,7 +46,7 @@ class IrConstImpl<out T> (
|
|||||||
startOffset: Int,
|
startOffset: Int,
|
||||||
endOffset: Int,
|
endOffset: Int,
|
||||||
type: KotlinType?,
|
type: KotlinType?,
|
||||||
override val kind: IrLiteralKind<T>,
|
override val kind: IrConstKind<T>,
|
||||||
override val value: T
|
override val value: T
|
||||||
) : IrTerminalExpressionBase(startOffset, endOffset, type), IrConst<T> {
|
) : IrTerminalExpressionBase(startOffset, endOffset, type), IrConst<T> {
|
||||||
override fun <R, D> accept(visitor: IrElementVisitor<R, D>, data: D): R =
|
override fun <R, D> accept(visitor: IrElementVisitor<R, D>, data: D): R =
|
||||||
@@ -54,16 +54,16 @@ class IrConstImpl<out T> (
|
|||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
fun string(startOffset: Int, endOffset: Int, type: KotlinType, value: String): IrConstImpl<String> =
|
fun string(startOffset: Int, endOffset: Int, type: KotlinType, value: String): IrConstImpl<String> =
|
||||||
IrConstImpl(startOffset, endOffset, type, IrLiteralKind.String, value)
|
IrConstImpl(startOffset, endOffset, type, IrConstKind.String, value)
|
||||||
|
|
||||||
fun int(startOffset: Int, endOffset: Int, type: KotlinType, value: Int): IrConstImpl<Int> =
|
fun int(startOffset: Int, endOffset: Int, type: KotlinType, value: Int): IrConstImpl<Int> =
|
||||||
IrConstImpl(startOffset, endOffset, type, IrLiteralKind.Int, value)
|
IrConstImpl(startOffset, endOffset, type, IrConstKind.Int, value)
|
||||||
|
|
||||||
fun constNull(startOffset: Int, endOffset: Int, type: KotlinType): IrConstImpl<Nothing?> =
|
fun constNull(startOffset: Int, endOffset: Int, type: KotlinType): IrConstImpl<Nothing?> =
|
||||||
IrConstImpl(startOffset, endOffset, type, IrLiteralKind.Null, null)
|
IrConstImpl(startOffset, endOffset, type, IrConstKind.Null, null)
|
||||||
|
|
||||||
fun boolean(startOffset: Int, endOffset: Int, type: KotlinType, value: Boolean): IrConstImpl<Boolean> =
|
fun boolean(startOffset: Int, endOffset: Int, type: KotlinType, value: Boolean): IrConstImpl<Boolean> =
|
||||||
IrConstImpl(startOffset, endOffset, type, IrLiteralKind.Boolean, value)
|
IrConstImpl(startOffset, endOffset, type, IrConstKind.Boolean, value)
|
||||||
|
|
||||||
fun constTrue(startOffset: Int, endOffset: Int, type: KotlinType): IrConstImpl<Boolean> =
|
fun constTrue(startOffset: Int, endOffset: Int, type: KotlinType): IrConstImpl<Boolean> =
|
||||||
boolean(startOffset, endOffset, type, true)
|
boolean(startOffset, endOffset, type, true)
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ interface IrOperator {
|
|||||||
}
|
}
|
||||||
|
|
||||||
object UMINUS : IrOperatorImpl("UMINUS")
|
object UMINUS : IrOperatorImpl("UMINUS")
|
||||||
|
object UPLUS : IrOperatorImpl("UPLUS")
|
||||||
object EXCL : IrOperatorImpl("EXCL")
|
object EXCL : IrOperatorImpl("EXCL")
|
||||||
object EXCLEXCL : IrOperatorImpl("EXCLEXCL")
|
object EXCLEXCL : IrOperatorImpl("EXCLEXCL")
|
||||||
|
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ class RenderIrElementVisitor : IrElementVisitor<String, Nothing?> {
|
|||||||
"? ${expression.javaClass.simpleName} type=${expression.renderType()}"
|
"? ${expression.javaClass.simpleName} type=${expression.renderType()}"
|
||||||
|
|
||||||
override fun <T> visitConst(expression: IrConst<T>, data: Nothing?): String =
|
override fun <T> visitConst(expression: IrConst<T>, data: Nothing?): String =
|
||||||
"LITERAL ${expression.kind} type=${expression.renderType()} value='${expression.value}'"
|
"CONST ${expression.kind} type=${expression.renderType()} value='${expression.value}'"
|
||||||
|
|
||||||
override fun visitBlock(expression: IrBlock, data: Nothing?): String =
|
override fun visitBlock(expression: IrBlock, data: Nothing?): String =
|
||||||
"BLOCK type=${expression.renderType()} hasResult=${expression.hasResult} operator=${expression.operator}"
|
"BLOCK type=${expression.renderType()} hasResult=${expression.hasResult} operator=${expression.operator}"
|
||||||
|
|||||||
+4
-4
@@ -7,13 +7,13 @@ IrFile /arrayAssignment.kt
|
|||||||
elements: DUMMY vararg type=kotlin.Int
|
elements: DUMMY vararg type=kotlin.Int
|
||||||
CALL .set type=kotlin.Unit operator=EQ
|
CALL .set type=kotlin.Unit operator=EQ
|
||||||
$this: GET_VAR x type=kotlin.IntArray operator=null
|
$this: GET_VAR x type=kotlin.IntArray operator=null
|
||||||
index: LITERAL Int type=kotlin.Int value='1'
|
index: CONST Int type=kotlin.Int value='1'
|
||||||
value: LITERAL Int type=kotlin.Int value='0'
|
value: CONST Int type=kotlin.Int value='0'
|
||||||
IrFunction public fun foo(): kotlin.Int
|
IrFunction public fun foo(): kotlin.Int
|
||||||
IrExpressionBody
|
IrExpressionBody
|
||||||
BLOCK type=<no-type> hasResult=false operator=null
|
BLOCK type=<no-type> hasResult=false operator=null
|
||||||
RETURN type=<no-type>
|
RETURN type=<no-type>
|
||||||
LITERAL Int type=kotlin.Int value='1'
|
CONST Int type=kotlin.Int value='1'
|
||||||
IrFunction public fun test2(): kotlin.Unit
|
IrFunction public fun test2(): kotlin.Unit
|
||||||
IrExpressionBody
|
IrExpressionBody
|
||||||
BLOCK type=<no-type> hasResult=false operator=null
|
BLOCK type=<no-type> hasResult=false operator=null
|
||||||
@@ -21,4 +21,4 @@ IrFile /arrayAssignment.kt
|
|||||||
$this: CALL .intArrayOf type=kotlin.IntArray operator=null
|
$this: CALL .intArrayOf type=kotlin.IntArray operator=null
|
||||||
elements: DUMMY vararg type=kotlin.Int
|
elements: DUMMY vararg type=kotlin.Int
|
||||||
index: CALL .foo type=kotlin.Int operator=null
|
index: CALL .foo type=kotlin.Int operator=null
|
||||||
value: LITERAL Int type=kotlin.Int value='1'
|
value: CONST Int type=kotlin.Int value='1'
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ IrFile /arrayAugmentedAssignment1.kt
|
|||||||
IrExpressionBody
|
IrExpressionBody
|
||||||
BLOCK type=<no-type> hasResult=false operator=null
|
BLOCK type=<no-type> hasResult=false operator=null
|
||||||
RETURN type=<no-type>
|
RETURN type=<no-type>
|
||||||
LITERAL Int type=kotlin.Int value='42'
|
CONST Int type=kotlin.Int value='42'
|
||||||
IrFunction public fun testVariable(): kotlin.Unit
|
IrFunction public fun testVariable(): kotlin.Unit
|
||||||
IrExpressionBody
|
IrExpressionBody
|
||||||
BLOCK type=<no-type> hasResult=false operator=null
|
BLOCK type=<no-type> hasResult=false operator=null
|
||||||
@@ -18,23 +18,23 @@ IrFile /arrayAugmentedAssignment1.kt
|
|||||||
BLOCK type=kotlin.Unit hasResult=false operator=PLUSEQ
|
BLOCK type=kotlin.Unit hasResult=false operator=PLUSEQ
|
||||||
CALL .set type=kotlin.Unit operator=PLUSEQ
|
CALL .set type=kotlin.Unit operator=PLUSEQ
|
||||||
$this: GET_VAR x type=kotlin.IntArray operator=null
|
$this: GET_VAR x type=kotlin.IntArray operator=null
|
||||||
index: LITERAL Int type=kotlin.Int value='0'
|
index: CONST Int type=kotlin.Int value='0'
|
||||||
value: CALL .plus type=kotlin.Int operator=PLUSEQ
|
value: CALL .plus type=kotlin.Int operator=PLUSEQ
|
||||||
$this: CALL .get type=kotlin.Int operator=PLUSEQ
|
$this: CALL .get type=kotlin.Int operator=PLUSEQ
|
||||||
$this: GET_VAR x type=kotlin.IntArray operator=null
|
$this: GET_VAR x type=kotlin.IntArray operator=null
|
||||||
index: LITERAL Int type=kotlin.Int value='0'
|
index: CONST Int type=kotlin.Int value='0'
|
||||||
other: LITERAL Int type=kotlin.Int value='1'
|
other: CONST Int type=kotlin.Int value='1'
|
||||||
BLOCK type=kotlin.Unit hasResult=false operator=MULTEQ
|
BLOCK type=kotlin.Unit hasResult=false operator=MULTEQ
|
||||||
VAR val tmp0_array: kotlin.IntArray
|
VAR val tmp0_array: kotlin.IntArray
|
||||||
CALL .foo type=kotlin.IntArray operator=null
|
CALL .foo type=kotlin.IntArray operator=null
|
||||||
CALL .set type=kotlin.Unit operator=MULTEQ
|
CALL .set type=kotlin.Unit operator=MULTEQ
|
||||||
$this: GET_VAR tmp0_array type=kotlin.IntArray operator=null
|
$this: GET_VAR tmp0_array type=kotlin.IntArray operator=null
|
||||||
index: LITERAL Int type=kotlin.Int value='0'
|
index: CONST Int type=kotlin.Int value='0'
|
||||||
value: CALL .times type=kotlin.Int operator=MULTEQ
|
value: CALL .times type=kotlin.Int operator=MULTEQ
|
||||||
$this: CALL .get type=kotlin.Int operator=MULTEQ
|
$this: CALL .get type=kotlin.Int operator=MULTEQ
|
||||||
$this: GET_VAR tmp0_array type=kotlin.IntArray operator=null
|
$this: GET_VAR tmp0_array type=kotlin.IntArray operator=null
|
||||||
index: LITERAL Int type=kotlin.Int value='0'
|
index: CONST Int type=kotlin.Int value='0'
|
||||||
other: LITERAL Int type=kotlin.Int value='2'
|
other: CONST Int type=kotlin.Int value='2'
|
||||||
BLOCK type=kotlin.Unit hasResult=false operator=MINUSEQ
|
BLOCK type=kotlin.Unit hasResult=false operator=MINUSEQ
|
||||||
VAR val tmp1_array: kotlin.IntArray
|
VAR val tmp1_array: kotlin.IntArray
|
||||||
CALL .foo type=kotlin.IntArray operator=null
|
CALL .foo type=kotlin.IntArray operator=null
|
||||||
@@ -47,4 +47,4 @@ IrFile /arrayAugmentedAssignment1.kt
|
|||||||
$this: CALL .get type=kotlin.Int operator=MINUSEQ
|
$this: CALL .get type=kotlin.Int operator=MINUSEQ
|
||||||
$this: GET_VAR tmp1_array type=kotlin.IntArray operator=null
|
$this: GET_VAR tmp1_array type=kotlin.IntArray operator=null
|
||||||
index: GET_VAR tmp2_index0 type=kotlin.Int operator=null
|
index: GET_VAR tmp2_index0 type=kotlin.Int operator=null
|
||||||
other: LITERAL Int type=kotlin.Int value='1'
|
other: CONST Int type=kotlin.Int value='1'
|
||||||
|
|||||||
@@ -8,9 +8,9 @@ IrFile /arrayAugmentedAssignment2.kt
|
|||||||
CALL .set type=kotlin.Unit operator=PLUSEQ
|
CALL .set type=kotlin.Unit operator=PLUSEQ
|
||||||
$this: $RECEIVER of: test type=IB
|
$this: $RECEIVER of: test type=IB
|
||||||
$receiver: GET_VAR a type=IA operator=null
|
$receiver: GET_VAR a type=IA operator=null
|
||||||
index: LITERAL String type=kotlin.String value=''
|
index: CONST String type=kotlin.String value=''
|
||||||
value: CALL .plus type=kotlin.Int operator=PLUSEQ
|
value: CALL .plus type=kotlin.Int operator=PLUSEQ
|
||||||
$this: CALL .get type=kotlin.Int operator=PLUSEQ
|
$this: CALL .get type=kotlin.Int operator=PLUSEQ
|
||||||
$this: GET_VAR a type=IA operator=null
|
$this: GET_VAR a type=IA operator=null
|
||||||
index: LITERAL String type=kotlin.String value=''
|
index: CONST String type=kotlin.String value=''
|
||||||
other: LITERAL Int type=kotlin.Int value='42'
|
other: CONST Int type=kotlin.Int value='42'
|
||||||
|
|||||||
+4
-4
@@ -4,16 +4,16 @@ IrFile /assignments.kt
|
|||||||
IrExpressionBody
|
IrExpressionBody
|
||||||
BLOCK type=<no-type> hasResult=false operator=null
|
BLOCK type=<no-type> hasResult=false operator=null
|
||||||
VAR var x: kotlin.Int
|
VAR var x: kotlin.Int
|
||||||
LITERAL Int type=kotlin.Int value='0'
|
CONST Int type=kotlin.Int value='0'
|
||||||
SET_VAR x type=<no-type> operator=EQ
|
SET_VAR x type=<no-type> operator=EQ
|
||||||
LITERAL Int type=kotlin.Int value='1'
|
CONST Int type=kotlin.Int value='1'
|
||||||
SET_VAR x type=<no-type> operator=EQ
|
SET_VAR x type=<no-type> operator=EQ
|
||||||
CALL .plus type=kotlin.Int operator=PLUS
|
CALL .plus type=kotlin.Int operator=PLUS
|
||||||
$this: GET_VAR x type=kotlin.Int operator=null
|
$this: GET_VAR x type=kotlin.Int operator=null
|
||||||
other: LITERAL Int type=kotlin.Int value='1'
|
other: CONST Int type=kotlin.Int value='1'
|
||||||
IrFunction public fun test2(/*0*/ r: Ref): kotlin.Unit
|
IrFunction public fun test2(/*0*/ r: Ref): kotlin.Unit
|
||||||
IrExpressionBody
|
IrExpressionBody
|
||||||
BLOCK type=<no-type> hasResult=false operator=null
|
BLOCK type=<no-type> hasResult=false operator=null
|
||||||
CALL .<set-x> type=kotlin.Unit operator=EQ
|
CALL .<set-x> type=kotlin.Unit operator=EQ
|
||||||
$this: GET_VAR r type=Ref operator=null
|
$this: GET_VAR r type=Ref operator=null
|
||||||
<set-?>: LITERAL Int type=kotlin.Int value='0'
|
<set-?>: CONST Int type=kotlin.Int value='0'
|
||||||
|
|||||||
+12
-12
@@ -1,52 +1,52 @@
|
|||||||
IrFile /augmentedAssignment1.kt
|
IrFile /augmentedAssignment1.kt
|
||||||
IrProperty public var p: kotlin.Int getter=null setter=null
|
IrProperty public var p: kotlin.Int getter=null setter=null
|
||||||
IrExpressionBody
|
IrExpressionBody
|
||||||
LITERAL Int type=kotlin.Int value='0'
|
CONST Int type=kotlin.Int value='0'
|
||||||
IrFunction public fun testVariable(): kotlin.Unit
|
IrFunction public fun testVariable(): kotlin.Unit
|
||||||
IrExpressionBody
|
IrExpressionBody
|
||||||
BLOCK type=kotlin.Int hasResult=true operator=null
|
BLOCK type=kotlin.Int hasResult=true operator=null
|
||||||
VAR var x: kotlin.Int
|
VAR var x: kotlin.Int
|
||||||
LITERAL Int type=kotlin.Int value='0'
|
CONST Int type=kotlin.Int value='0'
|
||||||
SET_VAR x type=<no-type> operator=PLUSEQ
|
SET_VAR x type=<no-type> operator=PLUSEQ
|
||||||
CALL .plus type=kotlin.Int operator=PLUSEQ
|
CALL .plus type=kotlin.Int operator=PLUSEQ
|
||||||
$this: GET_VAR x type=kotlin.Int operator=PLUSEQ
|
$this: GET_VAR x type=kotlin.Int operator=PLUSEQ
|
||||||
other: LITERAL Int type=kotlin.Int value='1'
|
other: CONST Int type=kotlin.Int value='1'
|
||||||
SET_VAR x type=<no-type> operator=MINUSEQ
|
SET_VAR x type=<no-type> operator=MINUSEQ
|
||||||
CALL .minus type=kotlin.Int operator=MINUSEQ
|
CALL .minus type=kotlin.Int operator=MINUSEQ
|
||||||
$this: GET_VAR x type=kotlin.Int operator=MINUSEQ
|
$this: GET_VAR x type=kotlin.Int operator=MINUSEQ
|
||||||
other: LITERAL Int type=kotlin.Int value='2'
|
other: CONST Int type=kotlin.Int value='2'
|
||||||
SET_VAR x type=<no-type> operator=MULTEQ
|
SET_VAR x type=<no-type> operator=MULTEQ
|
||||||
CALL .times type=kotlin.Int operator=MULTEQ
|
CALL .times type=kotlin.Int operator=MULTEQ
|
||||||
$this: GET_VAR x type=kotlin.Int operator=MULTEQ
|
$this: GET_VAR x type=kotlin.Int operator=MULTEQ
|
||||||
other: LITERAL Int type=kotlin.Int value='3'
|
other: CONST Int type=kotlin.Int value='3'
|
||||||
SET_VAR x type=<no-type> operator=DIVEQ
|
SET_VAR x type=<no-type> operator=DIVEQ
|
||||||
CALL .div type=kotlin.Int operator=DIVEQ
|
CALL .div type=kotlin.Int operator=DIVEQ
|
||||||
$this: GET_VAR x type=kotlin.Int operator=DIVEQ
|
$this: GET_VAR x type=kotlin.Int operator=DIVEQ
|
||||||
other: LITERAL Int type=kotlin.Int value='4'
|
other: CONST Int type=kotlin.Int value='4'
|
||||||
SET_VAR x type=<no-type> operator=PERCEQ
|
SET_VAR x type=<no-type> operator=PERCEQ
|
||||||
CALL .mod type=kotlin.Int operator=PERCEQ
|
CALL .mod type=kotlin.Int operator=PERCEQ
|
||||||
$this: GET_VAR x type=kotlin.Int operator=PERCEQ
|
$this: GET_VAR x type=kotlin.Int operator=PERCEQ
|
||||||
other: LITERAL Int type=kotlin.Int value='5'
|
other: CONST Int type=kotlin.Int value='5'
|
||||||
IrFunction public fun testProperty(): kotlin.Unit
|
IrFunction public fun testProperty(): kotlin.Unit
|
||||||
IrExpressionBody
|
IrExpressionBody
|
||||||
BLOCK type=kotlin.Int hasResult=true operator=null
|
BLOCK type=kotlin.Int hasResult=true operator=null
|
||||||
CALL .<set-p> type=kotlin.Unit operator=PLUSEQ
|
CALL .<set-p> type=kotlin.Unit operator=PLUSEQ
|
||||||
<set-?>: CALL .plus type=kotlin.Int operator=PLUSEQ
|
<set-?>: CALL .plus type=kotlin.Int operator=PLUSEQ
|
||||||
$this: CALL .<get-p> type=kotlin.Int operator=GET_PROPERTY
|
$this: CALL .<get-p> type=kotlin.Int operator=GET_PROPERTY
|
||||||
other: LITERAL Int type=kotlin.Int value='1'
|
other: CONST Int type=kotlin.Int value='1'
|
||||||
CALL .<set-p> type=kotlin.Unit operator=MINUSEQ
|
CALL .<set-p> type=kotlin.Unit operator=MINUSEQ
|
||||||
<set-?>: CALL .minus type=kotlin.Int operator=MINUSEQ
|
<set-?>: CALL .minus type=kotlin.Int operator=MINUSEQ
|
||||||
$this: CALL .<get-p> type=kotlin.Int operator=GET_PROPERTY
|
$this: CALL .<get-p> type=kotlin.Int operator=GET_PROPERTY
|
||||||
other: LITERAL Int type=kotlin.Int value='2'
|
other: CONST Int type=kotlin.Int value='2'
|
||||||
CALL .<set-p> type=kotlin.Unit operator=MULTEQ
|
CALL .<set-p> type=kotlin.Unit operator=MULTEQ
|
||||||
<set-?>: CALL .times type=kotlin.Int operator=MULTEQ
|
<set-?>: CALL .times type=kotlin.Int operator=MULTEQ
|
||||||
$this: CALL .<get-p> type=kotlin.Int operator=GET_PROPERTY
|
$this: CALL .<get-p> type=kotlin.Int operator=GET_PROPERTY
|
||||||
other: LITERAL Int type=kotlin.Int value='3'
|
other: CONST Int type=kotlin.Int value='3'
|
||||||
CALL .<set-p> type=kotlin.Unit operator=DIVEQ
|
CALL .<set-p> type=kotlin.Unit operator=DIVEQ
|
||||||
<set-?>: CALL .div type=kotlin.Int operator=DIVEQ
|
<set-?>: CALL .div type=kotlin.Int operator=DIVEQ
|
||||||
$this: CALL .<get-p> type=kotlin.Int operator=GET_PROPERTY
|
$this: CALL .<get-p> type=kotlin.Int operator=GET_PROPERTY
|
||||||
other: LITERAL Int type=kotlin.Int value='4'
|
other: CONST Int type=kotlin.Int value='4'
|
||||||
CALL .<set-p> type=kotlin.Unit operator=PERCEQ
|
CALL .<set-p> type=kotlin.Unit operator=PERCEQ
|
||||||
<set-?>: CALL .mod type=kotlin.Int operator=PERCEQ
|
<set-?>: CALL .mod type=kotlin.Int operator=PERCEQ
|
||||||
$this: CALL .<get-p> type=kotlin.Int operator=GET_PROPERTY
|
$this: CALL .<get-p> type=kotlin.Int operator=GET_PROPERTY
|
||||||
other: LITERAL Int type=kotlin.Int value='5'
|
other: CONST Int type=kotlin.Int value='5'
|
||||||
|
|||||||
+10
-10
@@ -25,34 +25,34 @@ IrFile /augmentedAssignment2.kt
|
|||||||
CALL .<init> type=A operator=null
|
CALL .<init> type=A operator=null
|
||||||
CALL .plusAssign type=kotlin.Unit operator=PLUSEQ
|
CALL .plusAssign type=kotlin.Unit operator=PLUSEQ
|
||||||
$receiver: GET_VAR a type=A operator=PLUSEQ
|
$receiver: GET_VAR a type=A operator=PLUSEQ
|
||||||
s: LITERAL String type=kotlin.String value='+='
|
s: CONST String type=kotlin.String value='+='
|
||||||
CALL .minusAssign type=kotlin.Unit operator=MINUSEQ
|
CALL .minusAssign type=kotlin.Unit operator=MINUSEQ
|
||||||
$receiver: GET_VAR a type=A operator=MINUSEQ
|
$receiver: GET_VAR a type=A operator=MINUSEQ
|
||||||
s: LITERAL String type=kotlin.String value='-='
|
s: CONST String type=kotlin.String value='-='
|
||||||
CALL .timesAssign type=kotlin.Unit operator=MULTEQ
|
CALL .timesAssign type=kotlin.Unit operator=MULTEQ
|
||||||
$receiver: GET_VAR a type=A operator=MULTEQ
|
$receiver: GET_VAR a type=A operator=MULTEQ
|
||||||
s: LITERAL String type=kotlin.String value='*='
|
s: CONST String type=kotlin.String value='*='
|
||||||
CALL .divAssign type=kotlin.Unit operator=DIVEQ
|
CALL .divAssign type=kotlin.Unit operator=DIVEQ
|
||||||
$receiver: GET_VAR a type=A operator=DIVEQ
|
$receiver: GET_VAR a type=A operator=DIVEQ
|
||||||
s: LITERAL String type=kotlin.String value='/='
|
s: CONST String type=kotlin.String value='/='
|
||||||
CALL .modAssign type=kotlin.Unit operator=PERCEQ
|
CALL .modAssign type=kotlin.Unit operator=PERCEQ
|
||||||
$receiver: GET_VAR a type=A operator=PERCEQ
|
$receiver: GET_VAR a type=A operator=PERCEQ
|
||||||
s: LITERAL String type=kotlin.String value='*='
|
s: CONST String type=kotlin.String value='*='
|
||||||
IrFunction public fun testProperty(): kotlin.Unit
|
IrFunction public fun testProperty(): kotlin.Unit
|
||||||
IrExpressionBody
|
IrExpressionBody
|
||||||
BLOCK type=<no-type> hasResult=false operator=null
|
BLOCK type=<no-type> hasResult=false operator=null
|
||||||
CALL .plusAssign type=kotlin.Unit operator=PLUSEQ
|
CALL .plusAssign type=kotlin.Unit operator=PLUSEQ
|
||||||
$receiver: CALL .<get-p> type=A operator=GET_PROPERTY
|
$receiver: CALL .<get-p> type=A operator=GET_PROPERTY
|
||||||
s: LITERAL String type=kotlin.String value='+='
|
s: CONST String type=kotlin.String value='+='
|
||||||
CALL .minusAssign type=kotlin.Unit operator=MINUSEQ
|
CALL .minusAssign type=kotlin.Unit operator=MINUSEQ
|
||||||
$receiver: CALL .<get-p> type=A operator=GET_PROPERTY
|
$receiver: CALL .<get-p> type=A operator=GET_PROPERTY
|
||||||
s: LITERAL String type=kotlin.String value='-='
|
s: CONST String type=kotlin.String value='-='
|
||||||
CALL .timesAssign type=kotlin.Unit operator=MULTEQ
|
CALL .timesAssign type=kotlin.Unit operator=MULTEQ
|
||||||
$receiver: CALL .<get-p> type=A operator=GET_PROPERTY
|
$receiver: CALL .<get-p> type=A operator=GET_PROPERTY
|
||||||
s: LITERAL String type=kotlin.String value='*='
|
s: CONST String type=kotlin.String value='*='
|
||||||
CALL .divAssign type=kotlin.Unit operator=DIVEQ
|
CALL .divAssign type=kotlin.Unit operator=DIVEQ
|
||||||
$receiver: CALL .<get-p> type=A operator=GET_PROPERTY
|
$receiver: CALL .<get-p> type=A operator=GET_PROPERTY
|
||||||
s: LITERAL String type=kotlin.String value='/='
|
s: CONST String type=kotlin.String value='/='
|
||||||
CALL .modAssign type=kotlin.Unit operator=PERCEQ
|
CALL .modAssign type=kotlin.Unit operator=PERCEQ
|
||||||
$receiver: CALL .<get-p> type=A operator=GET_PROPERTY
|
$receiver: CALL .<get-p> type=A operator=GET_PROPERTY
|
||||||
s: LITERAL String type=kotlin.String value='%='
|
s: CONST String type=kotlin.String value='%='
|
||||||
|
|||||||
+2
-2
@@ -6,14 +6,14 @@ IrFile /booleanOperators.kt
|
|||||||
WHEN type=kotlin.Boolean operator=ANDAND
|
WHEN type=kotlin.Boolean operator=ANDAND
|
||||||
if: GET_VAR a type=kotlin.Boolean operator=null
|
if: GET_VAR a type=kotlin.Boolean operator=null
|
||||||
then: GET_VAR b type=kotlin.Boolean operator=null
|
then: GET_VAR b type=kotlin.Boolean operator=null
|
||||||
else: LITERAL Boolean type=kotlin.Boolean value='false'
|
else: CONST Boolean type=kotlin.Boolean value='false'
|
||||||
IrFunction public fun test2(/*0*/ a: kotlin.Boolean, /*1*/ b: kotlin.Boolean): kotlin.Boolean
|
IrFunction public fun test2(/*0*/ a: kotlin.Boolean, /*1*/ b: kotlin.Boolean): kotlin.Boolean
|
||||||
IrExpressionBody
|
IrExpressionBody
|
||||||
BLOCK type=<no-type> hasResult=false operator=null
|
BLOCK type=<no-type> hasResult=false operator=null
|
||||||
RETURN type=<no-type>
|
RETURN type=<no-type>
|
||||||
WHEN type=kotlin.Boolean operator=OROR
|
WHEN type=kotlin.Boolean operator=OROR
|
||||||
if: GET_VAR a type=kotlin.Boolean operator=null
|
if: GET_VAR a type=kotlin.Boolean operator=null
|
||||||
then: LITERAL Boolean type=kotlin.Boolean value='true'
|
then: CONST Boolean type=kotlin.Boolean value='true'
|
||||||
else: GET_VAR b type=kotlin.Boolean operator=null
|
else: GET_VAR b type=kotlin.Boolean operator=null
|
||||||
IrFunction public fun test1x(/*0*/ a: kotlin.Boolean, /*1*/ b: kotlin.Boolean): kotlin.Boolean
|
IrFunction public fun test1x(/*0*/ a: kotlin.Boolean, /*1*/ b: kotlin.Boolean): kotlin.Boolean
|
||||||
IrExpressionBody
|
IrExpressionBody
|
||||||
|
|||||||
+1
-1
@@ -3,4 +3,4 @@ IrFile /boxOk.kt
|
|||||||
IrExpressionBody
|
IrExpressionBody
|
||||||
BLOCK type=<no-type> hasResult=false operator=null
|
BLOCK type=<no-type> hasResult=false operator=null
|
||||||
RETURN type=<no-type>
|
RETURN type=<no-type>
|
||||||
LITERAL String type=kotlin.String value='OK'
|
CONST String type=kotlin.String value='OK'
|
||||||
|
|||||||
@@ -6,22 +6,22 @@ IrFile /callWithReorderedArguments.kt
|
|||||||
IrExpressionBody
|
IrExpressionBody
|
||||||
BLOCK type=<no-type> hasResult=false operator=null
|
BLOCK type=<no-type> hasResult=false operator=null
|
||||||
RETURN type=<no-type>
|
RETURN type=<no-type>
|
||||||
LITERAL Int type=kotlin.Int value='1'
|
CONST Int type=kotlin.Int value='1'
|
||||||
IrFunction public fun noReorder2(): kotlin.Int
|
IrFunction public fun noReorder2(): kotlin.Int
|
||||||
IrExpressionBody
|
IrExpressionBody
|
||||||
BLOCK type=<no-type> hasResult=false operator=null
|
BLOCK type=<no-type> hasResult=false operator=null
|
||||||
RETURN type=<no-type>
|
RETURN type=<no-type>
|
||||||
LITERAL Int type=kotlin.Int value='2'
|
CONST Int type=kotlin.Int value='2'
|
||||||
IrFunction public fun reordered1(): kotlin.Int
|
IrFunction public fun reordered1(): kotlin.Int
|
||||||
IrExpressionBody
|
IrExpressionBody
|
||||||
BLOCK type=<no-type> hasResult=false operator=null
|
BLOCK type=<no-type> hasResult=false operator=null
|
||||||
RETURN type=<no-type>
|
RETURN type=<no-type>
|
||||||
LITERAL Int type=kotlin.Int value='1'
|
CONST Int type=kotlin.Int value='1'
|
||||||
IrFunction public fun reordered2(): kotlin.Int
|
IrFunction public fun reordered2(): kotlin.Int
|
||||||
IrExpressionBody
|
IrExpressionBody
|
||||||
BLOCK type=<no-type> hasResult=false operator=null
|
BLOCK type=<no-type> hasResult=false operator=null
|
||||||
RETURN type=<no-type>
|
RETURN type=<no-type>
|
||||||
LITERAL Int type=kotlin.Int value='2'
|
CONST Int type=kotlin.Int value='2'
|
||||||
IrFunction public fun test(): kotlin.Unit
|
IrFunction public fun test(): kotlin.Unit
|
||||||
IrExpressionBody
|
IrExpressionBody
|
||||||
BLOCK type=<no-type> hasResult=false operator=null
|
BLOCK type=<no-type> hasResult=false operator=null
|
||||||
@@ -41,4 +41,4 @@ IrFile /callWithReorderedArguments.kt
|
|||||||
CALL .reordered2 type=kotlin.Int operator=null
|
CALL .reordered2 type=kotlin.Int operator=null
|
||||||
CALL .foo type=kotlin.Unit operator=null
|
CALL .foo type=kotlin.Unit operator=null
|
||||||
a: GET_VAR tmp2_a type=kotlin.Int operator=null
|
a: GET_VAR tmp2_a type=kotlin.Int operator=null
|
||||||
b: LITERAL Int type=kotlin.Int value='1'
|
b: CONST Int type=kotlin.Int value='1'
|
||||||
|
|||||||
+1
-1
@@ -10,7 +10,7 @@ IrFile /calls.kt
|
|||||||
RETURN type=<no-type>
|
RETURN type=<no-type>
|
||||||
CALL .foo type=kotlin.Int operator=null
|
CALL .foo type=kotlin.Int operator=null
|
||||||
x: GET_VAR x type=kotlin.Int operator=null
|
x: GET_VAR x type=kotlin.Int operator=null
|
||||||
y: LITERAL Int type=kotlin.Int value='1'
|
y: CONST Int type=kotlin.Int value='1'
|
||||||
IrFunction public fun qux(/*0*/ x: kotlin.Int): kotlin.Int
|
IrFunction public fun qux(/*0*/ x: kotlin.Int): kotlin.Int
|
||||||
IrExpressionBody
|
IrExpressionBody
|
||||||
BLOCK type=<no-type> hasResult=false operator=null
|
BLOCK type=<no-type> hasResult=false operator=null
|
||||||
|
|||||||
Vendored
+10
-1
@@ -1,8 +1,17 @@
|
|||||||
|
val p: Any? = null
|
||||||
|
|
||||||
|
fun foo(): Any? = null
|
||||||
|
|
||||||
fun test1(a: Any?, b: Any) = a ?: b
|
fun test1(a: Any?, b: Any) = a ?: b
|
||||||
|
|
||||||
fun test2(a: String?, b: Any) = a ?: b
|
fun test2(a: String?, b: Any) = a ?: b
|
||||||
|
|
||||||
fun test3(a: Any?, b: Any?): String {
|
fun test3(a: Any?, b: Any?): String {
|
||||||
if (b !is String) return ""
|
if (b !is String) return ""
|
||||||
if (a !is String?) return ""
|
if (a !is String?) return ""
|
||||||
return a ?: b
|
return a ?: b
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun test4(x: Any) = p ?: x
|
||||||
|
|
||||||
|
fun test5(x: Any) = foo() ?: x
|
||||||
+59
-5
@@ -1,14 +1,32 @@
|
|||||||
IrFile /elvis.kt
|
IrFile /elvis.kt
|
||||||
|
IrProperty public val p: kotlin.Any? = null getter=null setter=null
|
||||||
|
IrExpressionBody
|
||||||
|
CONST Null type=kotlin.Nothing? value='null'
|
||||||
|
IrFunction public fun foo(): kotlin.Any?
|
||||||
|
IrExpressionBody
|
||||||
|
BLOCK type=<no-type> hasResult=false operator=null
|
||||||
|
RETURN type=<no-type>
|
||||||
|
CONST Null type=kotlin.Nothing? value='null'
|
||||||
IrFunction public fun test1(/*0*/ a: kotlin.Any?, /*1*/ b: kotlin.Any): kotlin.Any
|
IrFunction public fun test1(/*0*/ a: kotlin.Any?, /*1*/ b: kotlin.Any): kotlin.Any
|
||||||
IrExpressionBody
|
IrExpressionBody
|
||||||
BLOCK type=<no-type> hasResult=false operator=null
|
BLOCK type=<no-type> hasResult=false operator=null
|
||||||
RETURN type=<no-type>
|
RETURN type=<no-type>
|
||||||
DUMMY elvis type=kotlin.Any
|
WHEN type=kotlin.Any operator=ELVIS
|
||||||
|
if: CALL .EQEQ type=kotlin.Boolean operator=ELVIS
|
||||||
|
arg0: GET_VAR a type=kotlin.Any? operator=null
|
||||||
|
arg1: CONST Null type=kotlin.Nothing? value='null'
|
||||||
|
then: GET_VAR b type=kotlin.Any operator=null
|
||||||
|
else: GET_VAR a type=kotlin.Any? operator=null
|
||||||
IrFunction public fun test2(/*0*/ a: kotlin.String?, /*1*/ b: kotlin.Any): kotlin.Any
|
IrFunction public fun test2(/*0*/ a: kotlin.String?, /*1*/ b: kotlin.Any): kotlin.Any
|
||||||
IrExpressionBody
|
IrExpressionBody
|
||||||
BLOCK type=<no-type> hasResult=false operator=null
|
BLOCK type=<no-type> hasResult=false operator=null
|
||||||
RETURN type=<no-type>
|
RETURN type=<no-type>
|
||||||
DUMMY elvis type=kotlin.Any
|
WHEN type=kotlin.Any operator=ELVIS
|
||||||
|
if: CALL .EQEQ type=kotlin.Boolean operator=ELVIS
|
||||||
|
arg0: GET_VAR a type=kotlin.String? operator=null
|
||||||
|
arg1: CONST Null type=kotlin.Nothing? value='null'
|
||||||
|
then: GET_VAR b type=kotlin.Any operator=null
|
||||||
|
else: GET_VAR a type=kotlin.String? operator=null
|
||||||
IrFunction public fun test3(/*0*/ a: kotlin.Any?, /*1*/ b: kotlin.Any?): kotlin.String
|
IrFunction public fun test3(/*0*/ a: kotlin.Any?, /*1*/ b: kotlin.Any?): kotlin.String
|
||||||
IrExpressionBody
|
IrExpressionBody
|
||||||
BLOCK type=<no-type> hasResult=false operator=null
|
BLOCK type=<no-type> hasResult=false operator=null
|
||||||
@@ -16,11 +34,47 @@ IrFile /elvis.kt
|
|||||||
if: TYPE_OP operator=NOT_INSTANCEOF typeOperand=kotlin.String
|
if: TYPE_OP operator=NOT_INSTANCEOF typeOperand=kotlin.String
|
||||||
GET_VAR b type=kotlin.Any? operator=null
|
GET_VAR b type=kotlin.Any? operator=null
|
||||||
then: RETURN type=<no-type>
|
then: RETURN type=<no-type>
|
||||||
LITERAL String type=kotlin.String value=''
|
CONST String type=kotlin.String value=''
|
||||||
WHEN type=kotlin.Unit operator=IF
|
WHEN type=kotlin.Unit operator=IF
|
||||||
if: TYPE_OP operator=NOT_INSTANCEOF typeOperand=kotlin.String?
|
if: TYPE_OP operator=NOT_INSTANCEOF typeOperand=kotlin.String?
|
||||||
GET_VAR a type=kotlin.Any? operator=null
|
GET_VAR a type=kotlin.Any? operator=null
|
||||||
then: RETURN type=<no-type>
|
then: RETURN type=<no-type>
|
||||||
LITERAL String type=kotlin.String value=''
|
CONST String type=kotlin.String value=''
|
||||||
RETURN type=<no-type>
|
RETURN type=<no-type>
|
||||||
DUMMY elvis type=kotlin.String
|
BLOCK type=kotlin.String hasResult=true operator=ELVIS
|
||||||
|
VAR val tmp0: kotlin.String?
|
||||||
|
TYPE_OP operator=IMPLICIT_CAST typeOperand=kotlin.String?
|
||||||
|
GET_VAR a type=kotlin.Any? operator=null
|
||||||
|
WHEN type=kotlin.String operator=ELVIS
|
||||||
|
if: CALL .EQEQ type=kotlin.Boolean operator=ELVIS
|
||||||
|
arg0: GET_VAR tmp0 type=kotlin.String? operator=null
|
||||||
|
arg1: CONST Null type=kotlin.Nothing? value='null'
|
||||||
|
then: TYPE_OP operator=IMPLICIT_CAST typeOperand=kotlin.String
|
||||||
|
GET_VAR b type=kotlin.Any? operator=null
|
||||||
|
else: GET_VAR tmp0 type=kotlin.String? operator=null
|
||||||
|
IrFunction public fun test4(/*0*/ x: kotlin.Any): kotlin.Any
|
||||||
|
IrExpressionBody
|
||||||
|
BLOCK type=<no-type> hasResult=false operator=null
|
||||||
|
RETURN type=<no-type>
|
||||||
|
BLOCK type=kotlin.Any hasResult=true operator=ELVIS
|
||||||
|
VAR val tmp0: kotlin.Any?
|
||||||
|
CALL .<get-p> type=kotlin.Any? operator=GET_PROPERTY
|
||||||
|
WHEN type=kotlin.Any operator=ELVIS
|
||||||
|
if: CALL .EQEQ type=kotlin.Boolean operator=ELVIS
|
||||||
|
arg0: GET_VAR tmp0 type=kotlin.Any? operator=null
|
||||||
|
arg1: CONST Null type=kotlin.Nothing? value='null'
|
||||||
|
then: GET_VAR x type=kotlin.Any operator=null
|
||||||
|
else: GET_VAR tmp0 type=kotlin.Any? operator=null
|
||||||
|
IrFunction public fun test5(/*0*/ x: kotlin.Any): kotlin.Any
|
||||||
|
IrExpressionBody
|
||||||
|
BLOCK type=<no-type> hasResult=false operator=null
|
||||||
|
RETURN type=<no-type>
|
||||||
|
BLOCK type=kotlin.Any hasResult=true operator=ELVIS
|
||||||
|
VAR val tmp0: kotlin.Any?
|
||||||
|
CALL .foo type=kotlin.Any? operator=null
|
||||||
|
WHEN type=kotlin.Any operator=ELVIS
|
||||||
|
if: CALL .EQEQ type=kotlin.Boolean operator=ELVIS
|
||||||
|
arg0: GET_VAR tmp0 type=kotlin.Any? operator=null
|
||||||
|
arg1: CONST Null type=kotlin.Nothing? value='null'
|
||||||
|
then: GET_VAR x type=kotlin.Any operator=null
|
||||||
|
else: GET_VAR tmp0 type=kotlin.Any? operator=null
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ IrFile /extensionPropertyGetterCall.kt
|
|||||||
IrExpressionBody
|
IrExpressionBody
|
||||||
BLOCK type=<no-type> hasResult=false operator=null
|
BLOCK type=<no-type> hasResult=false operator=null
|
||||||
RETURN type=<no-type>
|
RETURN type=<no-type>
|
||||||
LITERAL String type=kotlin.String value='OK'
|
CONST String type=kotlin.String value='OK'
|
||||||
IrFunction public fun kotlin.String.test5(): kotlin.String
|
IrFunction public fun kotlin.String.test5(): kotlin.String
|
||||||
IrExpressionBody
|
IrExpressionBody
|
||||||
BLOCK type=<no-type> hasResult=false operator=null
|
BLOCK type=<no-type> hasResult=false operator=null
|
||||||
|
|||||||
+8
-7
@@ -7,11 +7,12 @@ IrFile /ifElseIf.kt
|
|||||||
if: CALL .GT0 type=kotlin.Boolean operator=GT
|
if: CALL .GT0 type=kotlin.Boolean operator=GT
|
||||||
arg0: CALL .compareTo type=kotlin.Int operator=GT
|
arg0: CALL .compareTo type=kotlin.Int operator=GT
|
||||||
$this: GET_VAR i type=kotlin.Int operator=null
|
$this: GET_VAR i type=kotlin.Int operator=null
|
||||||
other: LITERAL Int type=kotlin.Int value='0'
|
other: CONST Int type=kotlin.Int value='0'
|
||||||
then: LITERAL Int type=kotlin.Int value='1'
|
then: CONST Int type=kotlin.Int value='1'
|
||||||
if: CALL .GT0 type=kotlin.Boolean operator=GT
|
if: CALL .LT0 type=kotlin.Boolean operator=LT
|
||||||
arg0: CALL .compareTo type=kotlin.Int operator=GT
|
arg0: CALL .compareTo type=kotlin.Int operator=LT
|
||||||
$this: GET_VAR i type=kotlin.Int operator=null
|
$this: GET_VAR i type=kotlin.Int operator=null
|
||||||
other: LITERAL Int type=kotlin.Int value='0'
|
other: CONST Int type=kotlin.Int value='0'
|
||||||
then: LITERAL Int type=kotlin.Int value='1'
|
then: CALL .unaryMinus type=kotlin.Int operator=UMINUS
|
||||||
else: LITERAL Int type=kotlin.Int value='0'
|
$this: CONST Int type=kotlin.Int value='1'
|
||||||
|
else: CONST Int type=kotlin.Int value='0'
|
||||||
|
|||||||
+10
-3
@@ -3,6 +3,13 @@ IrFile /implicitCastOnPlatformType.kt
|
|||||||
IrExpressionBody
|
IrExpressionBody
|
||||||
BLOCK type=<no-type> hasResult=false operator=null
|
BLOCK type=<no-type> hasResult=false operator=null
|
||||||
RETURN type=<no-type>
|
RETURN type=<no-type>
|
||||||
CALL .IMPLICIT_NOT_NULL type=kotlin.Any operator=IMPLICIT_NOTNULL
|
BLOCK type=kotlin.String hasResult=true operator=IMPLICIT_NOTNULL
|
||||||
arg0: CALL .getProperty type=kotlin.String! operator=null
|
VAR val tmp0: kotlin.String!
|
||||||
p0: LITERAL String type=kotlin.String value='test'
|
CALL .getProperty type=kotlin.String! operator=null
|
||||||
|
p0: CONST String type=kotlin.String value='test'
|
||||||
|
WHEN type=kotlin.String operator=IMPLICIT_NOTNULL
|
||||||
|
if: CALL .EQEQ type=kotlin.Boolean operator=IMPLICIT_NOTNULL
|
||||||
|
arg0: GET_VAR tmp0 type=kotlin.String! operator=null
|
||||||
|
arg1: CONST Null type=kotlin.Nothing? value='null'
|
||||||
|
then: CALL .THROW_NPE type=kotlin.Nothing operator=IMPLICIT_NOTNULL
|
||||||
|
else: GET_VAR tmp0 type=kotlin.String! operator=null
|
||||||
|
|||||||
+19
-3
@@ -1,18 +1,34 @@
|
|||||||
var p: Int = 0
|
var p: Int = 0
|
||||||
val arr = intArrayOf(1, 2, 3)
|
val arr = intArrayOf(1, 2, 3)
|
||||||
|
|
||||||
fun testVar() {
|
fun testVarPrefix() {
|
||||||
var x = 0
|
var x = 0
|
||||||
val x1 = ++x
|
val x1 = ++x
|
||||||
val x2 = --x
|
val x2 = --x
|
||||||
}
|
}
|
||||||
|
|
||||||
fun testProp() {
|
fun testVarPostfix() {
|
||||||
|
var x = 0
|
||||||
|
val x1 = x++
|
||||||
|
val x2 = x--
|
||||||
|
}
|
||||||
|
|
||||||
|
fun testPropPrefix() {
|
||||||
val p1 = ++p
|
val p1 = ++p
|
||||||
val p2 = --p
|
val p2 = --p
|
||||||
}
|
}
|
||||||
|
|
||||||
fun testArray() {
|
fun testPropPostfix() {
|
||||||
|
val p1 = p++
|
||||||
|
val p2 = --p
|
||||||
|
}
|
||||||
|
|
||||||
|
fun testArrayPrefix() {
|
||||||
val a1 = ++arr[0]
|
val a1 = ++arr[0]
|
||||||
val a2 = --arr[0]
|
val a2 = --arr[0]
|
||||||
|
}
|
||||||
|
|
||||||
|
fun testArrayPostfix() {
|
||||||
|
val a1 = arr[0]++
|
||||||
|
val a2 = arr[0]--
|
||||||
}
|
}
|
||||||
+80
-9
@@ -1,16 +1,16 @@
|
|||||||
IrFile /incrementDecrement.kt
|
IrFile /incrementDecrement.kt
|
||||||
IrProperty public var p: kotlin.Int getter=null setter=null
|
IrProperty public var p: kotlin.Int getter=null setter=null
|
||||||
IrExpressionBody
|
IrExpressionBody
|
||||||
LITERAL Int type=kotlin.Int value='0'
|
CONST Int type=kotlin.Int value='0'
|
||||||
IrProperty public val arr: kotlin.IntArray getter=null setter=null
|
IrProperty public val arr: kotlin.IntArray getter=null setter=null
|
||||||
IrExpressionBody
|
IrExpressionBody
|
||||||
CALL .intArrayOf type=kotlin.IntArray operator=null
|
CALL .intArrayOf type=kotlin.IntArray operator=null
|
||||||
elements: DUMMY vararg type=kotlin.Int
|
elements: DUMMY vararg type=kotlin.Int
|
||||||
IrFunction public fun testVar(): kotlin.Unit
|
IrFunction public fun testVarPrefix(): kotlin.Unit
|
||||||
IrExpressionBody
|
IrExpressionBody
|
||||||
BLOCK type=<no-type> hasResult=false operator=null
|
BLOCK type=<no-type> hasResult=false operator=null
|
||||||
VAR var x: kotlin.Int
|
VAR var x: kotlin.Int
|
||||||
LITERAL Int type=kotlin.Int value='0'
|
CONST Int type=kotlin.Int value='0'
|
||||||
VAR val x1: kotlin.Int
|
VAR val x1: kotlin.Int
|
||||||
BLOCK type=kotlin.Int hasResult=true operator=PREFIX_INCR
|
BLOCK type=kotlin.Int hasResult=true operator=PREFIX_INCR
|
||||||
VAR val tmp0: kotlin.Int
|
VAR val tmp0: kotlin.Int
|
||||||
@@ -27,7 +27,28 @@ IrFile /incrementDecrement.kt
|
|||||||
SET_VAR x type=<no-type> operator=PREFIX_DECR
|
SET_VAR x type=<no-type> operator=PREFIX_DECR
|
||||||
GET_VAR tmp1 type=kotlin.Int operator=null
|
GET_VAR tmp1 type=kotlin.Int operator=null
|
||||||
GET_VAR tmp1 type=kotlin.Int operator=null
|
GET_VAR tmp1 type=kotlin.Int operator=null
|
||||||
IrFunction public fun testProp(): kotlin.Unit
|
IrFunction public fun testVarPostfix(): kotlin.Unit
|
||||||
|
IrExpressionBody
|
||||||
|
BLOCK type=<no-type> hasResult=false operator=null
|
||||||
|
VAR var x: kotlin.Int
|
||||||
|
CONST Int type=kotlin.Int value='0'
|
||||||
|
VAR val x1: kotlin.Int
|
||||||
|
BLOCK type=kotlin.Int hasResult=true operator=POSTFIX_INCR
|
||||||
|
VAR val tmp0: kotlin.Int
|
||||||
|
GET_VAR x type=kotlin.Int operator=POSTFIX_INCR
|
||||||
|
SET_VAR x type=<no-type> operator=POSTFIX_INCR
|
||||||
|
CALL .inc type=kotlin.Int operator=POSTFIX_INCR
|
||||||
|
$this: GET_VAR tmp0 type=kotlin.Int operator=POSTFIX_INCR
|
||||||
|
GET_VAR tmp0 type=kotlin.Int operator=null
|
||||||
|
VAR val x2: kotlin.Int
|
||||||
|
BLOCK type=kotlin.Int hasResult=true operator=POSTFIX_DECR
|
||||||
|
VAR val tmp1: kotlin.Int
|
||||||
|
GET_VAR x type=kotlin.Int operator=POSTFIX_DECR
|
||||||
|
SET_VAR x type=<no-type> operator=POSTFIX_DECR
|
||||||
|
CALL .dec type=kotlin.Int operator=POSTFIX_DECR
|
||||||
|
$this: GET_VAR tmp1 type=kotlin.Int operator=POSTFIX_DECR
|
||||||
|
GET_VAR tmp1 type=kotlin.Int operator=null
|
||||||
|
IrFunction public fun testPropPrefix(): kotlin.Unit
|
||||||
IrExpressionBody
|
IrExpressionBody
|
||||||
BLOCK type=<no-type> hasResult=false operator=null
|
BLOCK type=<no-type> hasResult=false operator=null
|
||||||
VAR val p1: kotlin.Int
|
VAR val p1: kotlin.Int
|
||||||
@@ -46,7 +67,26 @@ IrFile /incrementDecrement.kt
|
|||||||
CALL .<set-p> type=kotlin.Unit operator=PREFIX_DECR
|
CALL .<set-p> type=kotlin.Unit operator=PREFIX_DECR
|
||||||
<set-?>: GET_VAR tmp1 type=kotlin.Int operator=null
|
<set-?>: GET_VAR tmp1 type=kotlin.Int operator=null
|
||||||
GET_VAR tmp1 type=kotlin.Int operator=null
|
GET_VAR tmp1 type=kotlin.Int operator=null
|
||||||
IrFunction public fun testArray(): kotlin.Unit
|
IrFunction public fun testPropPostfix(): kotlin.Unit
|
||||||
|
IrExpressionBody
|
||||||
|
BLOCK type=<no-type> hasResult=false operator=null
|
||||||
|
VAR val p1: kotlin.Int
|
||||||
|
BLOCK type=kotlin.Int hasResult=true operator=POSTFIX_INCR
|
||||||
|
VAR val tmp0: kotlin.Int
|
||||||
|
CALL .<get-p> type=kotlin.Int operator=GET_PROPERTY
|
||||||
|
CALL .<set-p> type=kotlin.Unit operator=POSTFIX_INCR
|
||||||
|
<set-?>: CALL .inc type=kotlin.Int operator=POSTFIX_INCR
|
||||||
|
$this: GET_VAR tmp0 type=kotlin.Int operator=POSTFIX_INCR
|
||||||
|
GET_VAR tmp0 type=kotlin.Int operator=null
|
||||||
|
VAR val p2: kotlin.Int
|
||||||
|
BLOCK type=kotlin.Int hasResult=true operator=PREFIX_DECR
|
||||||
|
VAR val tmp1: kotlin.Int
|
||||||
|
CALL .dec type=kotlin.Int operator=PREFIX_DECR
|
||||||
|
$this: CALL .<get-p> type=kotlin.Int operator=GET_PROPERTY
|
||||||
|
CALL .<set-p> type=kotlin.Unit operator=PREFIX_DECR
|
||||||
|
<set-?>: GET_VAR tmp1 type=kotlin.Int operator=null
|
||||||
|
GET_VAR tmp1 type=kotlin.Int operator=null
|
||||||
|
IrFunction public fun testArrayPrefix(): kotlin.Unit
|
||||||
IrExpressionBody
|
IrExpressionBody
|
||||||
BLOCK type=<no-type> hasResult=false operator=null
|
BLOCK type=<no-type> hasResult=false operator=null
|
||||||
VAR val a1: kotlin.Int
|
VAR val a1: kotlin.Int
|
||||||
@@ -57,10 +97,10 @@ IrFile /incrementDecrement.kt
|
|||||||
CALL .inc type=kotlin.Int operator=PREFIX_INCR
|
CALL .inc type=kotlin.Int operator=PREFIX_INCR
|
||||||
$this: CALL .get type=kotlin.Int operator=PREFIX_INCR
|
$this: CALL .get type=kotlin.Int operator=PREFIX_INCR
|
||||||
$this: GET_VAR tmp0_array type=kotlin.IntArray operator=null
|
$this: GET_VAR tmp0_array type=kotlin.IntArray operator=null
|
||||||
index: LITERAL Int type=kotlin.Int value='0'
|
index: CONST Int type=kotlin.Int value='0'
|
||||||
CALL .set type=kotlin.Unit operator=PREFIX_INCR
|
CALL .set type=kotlin.Unit operator=PREFIX_INCR
|
||||||
$this: GET_VAR tmp0_array type=kotlin.IntArray operator=null
|
$this: GET_VAR tmp0_array type=kotlin.IntArray operator=null
|
||||||
index: LITERAL Int type=kotlin.Int value='0'
|
index: CONST Int type=kotlin.Int value='0'
|
||||||
value: GET_VAR tmp1 type=kotlin.Int operator=null
|
value: GET_VAR tmp1 type=kotlin.Int operator=null
|
||||||
GET_VAR tmp1 type=kotlin.Int operator=null
|
GET_VAR tmp1 type=kotlin.Int operator=null
|
||||||
VAR val a2: kotlin.Int
|
VAR val a2: kotlin.Int
|
||||||
@@ -71,9 +111,40 @@ IrFile /incrementDecrement.kt
|
|||||||
CALL .dec type=kotlin.Int operator=PREFIX_DECR
|
CALL .dec type=kotlin.Int operator=PREFIX_DECR
|
||||||
$this: CALL .get type=kotlin.Int operator=PREFIX_DECR
|
$this: CALL .get type=kotlin.Int operator=PREFIX_DECR
|
||||||
$this: GET_VAR tmp2_array type=kotlin.IntArray operator=null
|
$this: GET_VAR tmp2_array type=kotlin.IntArray operator=null
|
||||||
index: LITERAL Int type=kotlin.Int value='0'
|
index: CONST Int type=kotlin.Int value='0'
|
||||||
CALL .set type=kotlin.Unit operator=PREFIX_DECR
|
CALL .set type=kotlin.Unit operator=PREFIX_DECR
|
||||||
$this: GET_VAR tmp2_array type=kotlin.IntArray operator=null
|
$this: GET_VAR tmp2_array type=kotlin.IntArray operator=null
|
||||||
index: LITERAL Int type=kotlin.Int value='0'
|
index: CONST Int type=kotlin.Int value='0'
|
||||||
value: GET_VAR tmp3 type=kotlin.Int operator=null
|
value: GET_VAR tmp3 type=kotlin.Int operator=null
|
||||||
GET_VAR tmp3 type=kotlin.Int operator=null
|
GET_VAR tmp3 type=kotlin.Int operator=null
|
||||||
|
IrFunction public fun testArrayPostfix(): kotlin.Unit
|
||||||
|
IrExpressionBody
|
||||||
|
BLOCK type=<no-type> hasResult=false operator=null
|
||||||
|
VAR val a1: kotlin.Int
|
||||||
|
BLOCK type=kotlin.Int hasResult=true operator=POSTFIX_INCR
|
||||||
|
VAR val tmp0_array: kotlin.IntArray
|
||||||
|
CALL .<get-arr> type=kotlin.IntArray operator=GET_PROPERTY
|
||||||
|
VAR val tmp1: kotlin.Int
|
||||||
|
CALL .get type=kotlin.Int operator=POSTFIX_INCR
|
||||||
|
$this: GET_VAR tmp0_array type=kotlin.IntArray operator=null
|
||||||
|
index: CONST Int type=kotlin.Int value='0'
|
||||||
|
CALL .set type=kotlin.Unit operator=POSTFIX_INCR
|
||||||
|
$this: GET_VAR tmp0_array type=kotlin.IntArray operator=null
|
||||||
|
index: CONST Int type=kotlin.Int value='0'
|
||||||
|
value: CALL .inc type=kotlin.Int operator=POSTFIX_INCR
|
||||||
|
$this: GET_VAR tmp1 type=kotlin.Int operator=null
|
||||||
|
GET_VAR tmp1 type=kotlin.Int operator=null
|
||||||
|
VAR val a2: kotlin.Int
|
||||||
|
BLOCK type=kotlin.Int hasResult=true operator=POSTFIX_DECR
|
||||||
|
VAR val tmp2_array: kotlin.IntArray
|
||||||
|
CALL .<get-arr> type=kotlin.IntArray operator=GET_PROPERTY
|
||||||
|
VAR val tmp3: kotlin.Int
|
||||||
|
CALL .get type=kotlin.Int operator=POSTFIX_DECR
|
||||||
|
$this: GET_VAR tmp2_array type=kotlin.IntArray operator=null
|
||||||
|
index: CONST Int type=kotlin.Int value='0'
|
||||||
|
CALL .set type=kotlin.Unit operator=POSTFIX_DECR
|
||||||
|
$this: GET_VAR tmp2_array type=kotlin.IntArray operator=null
|
||||||
|
index: CONST Int type=kotlin.Int value='0'
|
||||||
|
value: CALL .dec type=kotlin.Int operator=POSTFIX_DECR
|
||||||
|
$this: GET_VAR tmp3 type=kotlin.Int operator=null
|
||||||
|
GET_VAR tmp3 type=kotlin.Int operator=null
|
||||||
|
|||||||
+6
@@ -0,0 +1,6 @@
|
|||||||
|
val test1 = 1
|
||||||
|
val test2 = -1
|
||||||
|
val test3 = true
|
||||||
|
val test4 = false
|
||||||
|
val test5 = "abc"
|
||||||
|
val test6 = null
|
||||||
+20
@@ -0,0 +1,20 @@
|
|||||||
|
IrFile /literals.kt
|
||||||
|
IrProperty public val test1: kotlin.Int = 1 getter=null setter=null
|
||||||
|
IrExpressionBody
|
||||||
|
CONST Int type=kotlin.Int value='1'
|
||||||
|
IrProperty public val test2: kotlin.Int = -1 getter=null setter=null
|
||||||
|
IrExpressionBody
|
||||||
|
CALL .unaryMinus type=kotlin.Int operator=UMINUS
|
||||||
|
$this: CONST Int type=kotlin.Int value='1'
|
||||||
|
IrProperty public val test3: kotlin.Boolean = true getter=null setter=null
|
||||||
|
IrExpressionBody
|
||||||
|
CONST Boolean type=kotlin.Boolean value='true'
|
||||||
|
IrProperty public val test4: kotlin.Boolean = false getter=null setter=null
|
||||||
|
IrExpressionBody
|
||||||
|
CONST Boolean type=kotlin.Boolean value='false'
|
||||||
|
IrProperty public val test5: kotlin.String = "abc" getter=null setter=null
|
||||||
|
IrExpressionBody
|
||||||
|
CONST String type=kotlin.String value='abc'
|
||||||
|
IrProperty public val test6: kotlin.Nothing? = null getter=null setter=null
|
||||||
|
IrExpressionBody
|
||||||
|
CONST Null type=kotlin.Nothing? value='null'
|
||||||
+4
-4
@@ -1,7 +1,7 @@
|
|||||||
IrFile /references.kt
|
IrFile /references.kt
|
||||||
IrProperty public val ok: kotlin.String = "OK" getter=null setter=null
|
IrProperty public val ok: kotlin.String = "OK" getter=null setter=null
|
||||||
IrExpressionBody
|
IrExpressionBody
|
||||||
LITERAL String type=kotlin.String value='OK'
|
CONST String type=kotlin.String value='OK'
|
||||||
IrProperty public val ok2: kotlin.String = "OK" getter=null setter=null
|
IrProperty public val ok2: kotlin.String = "OK" getter=null setter=null
|
||||||
IrExpressionBody
|
IrExpressionBody
|
||||||
CALL .<get-ok> type=kotlin.String operator=GET_PROPERTY
|
CALL .<get-ok> type=kotlin.String operator=GET_PROPERTY
|
||||||
@@ -10,7 +10,7 @@ IrFile /references.kt
|
|||||||
IrExpressionBody
|
IrExpressionBody
|
||||||
BLOCK type=<no-type> hasResult=false operator=null
|
BLOCK type=<no-type> hasResult=false operator=null
|
||||||
RETURN type=<no-type>
|
RETURN type=<no-type>
|
||||||
LITERAL String type=kotlin.String value='OK'
|
CONST String type=kotlin.String value='OK'
|
||||||
IrFunction public fun test1(): kotlin.String
|
IrFunction public fun test1(): kotlin.String
|
||||||
IrExpressionBody
|
IrExpressionBody
|
||||||
BLOCK type=<no-type> hasResult=false operator=null
|
BLOCK type=<no-type> hasResult=false operator=null
|
||||||
@@ -25,7 +25,7 @@ IrFile /references.kt
|
|||||||
IrExpressionBody
|
IrExpressionBody
|
||||||
BLOCK type=<no-type> hasResult=false operator=null
|
BLOCK type=<no-type> hasResult=false operator=null
|
||||||
VAR val x: kotlin.String = "OK"
|
VAR val x: kotlin.String = "OK"
|
||||||
LITERAL String type=kotlin.String value='OK'
|
CONST String type=kotlin.String value='OK'
|
||||||
RETURN type=<no-type>
|
RETURN type=<no-type>
|
||||||
GET_VAR x type=kotlin.String operator=null
|
GET_VAR x type=kotlin.String operator=null
|
||||||
IrFunction public fun test4(): kotlin.String
|
IrFunction public fun test4(): kotlin.String
|
||||||
@@ -38,7 +38,7 @@ IrFile /references.kt
|
|||||||
IrExpressionBody
|
IrExpressionBody
|
||||||
BLOCK type=<no-type> hasResult=false operator=null
|
BLOCK type=<no-type> hasResult=false operator=null
|
||||||
RETURN type=<no-type>
|
RETURN type=<no-type>
|
||||||
LITERAL String type=kotlin.String value='OK'
|
CONST String type=kotlin.String value='OK'
|
||||||
IrFunction public fun kotlin.String.test5(): kotlin.String
|
IrFunction public fun kotlin.String.test5(): kotlin.String
|
||||||
IrExpressionBody
|
IrExpressionBody
|
||||||
BLOCK type=<no-type> hasResult=false operator=null
|
BLOCK type=<no-type> hasResult=false operator=null
|
||||||
|
|||||||
@@ -0,0 +1,8 @@
|
|||||||
|
fun test1(x: Int) = -x
|
||||||
|
fun test2() = -42
|
||||||
|
|
||||||
|
fun test3(x: Int) = +x
|
||||||
|
fun test4() = +42
|
||||||
|
|
||||||
|
fun test5(x: Boolean) = !x
|
||||||
|
fun test6() = !true
|
||||||
@@ -0,0 +1,37 @@
|
|||||||
|
IrFile /simpleUnaryOperators.kt
|
||||||
|
IrFunction public fun test1(/*0*/ x: kotlin.Int): kotlin.Int
|
||||||
|
IrExpressionBody
|
||||||
|
BLOCK type=<no-type> hasResult=false operator=null
|
||||||
|
RETURN type=<no-type>
|
||||||
|
CALL .unaryMinus type=kotlin.Int operator=UMINUS
|
||||||
|
$this: GET_VAR x type=kotlin.Int operator=null
|
||||||
|
IrFunction public fun test2(): kotlin.Int
|
||||||
|
IrExpressionBody
|
||||||
|
BLOCK type=<no-type> hasResult=false operator=null
|
||||||
|
RETURN type=<no-type>
|
||||||
|
CALL .unaryMinus type=kotlin.Int operator=UMINUS
|
||||||
|
$this: CONST Int type=kotlin.Int value='42'
|
||||||
|
IrFunction public fun test3(/*0*/ x: kotlin.Int): kotlin.Int
|
||||||
|
IrExpressionBody
|
||||||
|
BLOCK type=<no-type> hasResult=false operator=null
|
||||||
|
RETURN type=<no-type>
|
||||||
|
CALL .unaryPlus type=kotlin.Int operator=UPLUS
|
||||||
|
$this: GET_VAR x type=kotlin.Int operator=null
|
||||||
|
IrFunction public fun test4(): kotlin.Int
|
||||||
|
IrExpressionBody
|
||||||
|
BLOCK type=<no-type> hasResult=false operator=null
|
||||||
|
RETURN type=<no-type>
|
||||||
|
CALL .unaryPlus type=kotlin.Int operator=UPLUS
|
||||||
|
$this: CONST Int type=kotlin.Int value='42'
|
||||||
|
IrFunction public fun test5(/*0*/ x: kotlin.Boolean): kotlin.Boolean
|
||||||
|
IrExpressionBody
|
||||||
|
BLOCK type=<no-type> hasResult=false operator=null
|
||||||
|
RETURN type=<no-type>
|
||||||
|
CALL .not type=kotlin.Boolean operator=EXCL
|
||||||
|
$this: GET_VAR x type=kotlin.Boolean operator=null
|
||||||
|
IrFunction public fun test6(): kotlin.Boolean
|
||||||
|
IrExpressionBody
|
||||||
|
BLOCK type=<no-type> hasResult=false operator=null
|
||||||
|
RETURN type=<no-type>
|
||||||
|
CALL .not type=kotlin.Boolean operator=EXCL
|
||||||
|
$this: CONST Boolean type=kotlin.Boolean value='true'
|
||||||
+2
-2
@@ -44,7 +44,7 @@ IrFile /smartCasts.kt
|
|||||||
if: TYPE_OP operator=NOT_INSTANCEOF typeOperand=kotlin.String
|
if: TYPE_OP operator=NOT_INSTANCEOF typeOperand=kotlin.String
|
||||||
GET_VAR x type=kotlin.Any operator=null
|
GET_VAR x type=kotlin.Any operator=null
|
||||||
then: RETURN type=<no-type>
|
then: RETURN type=<no-type>
|
||||||
LITERAL String type=kotlin.String value=''
|
CONST String type=kotlin.String value=''
|
||||||
RETURN type=<no-type>
|
RETURN type=<no-type>
|
||||||
CALL .overloaded type=kotlin.String operator=null
|
CALL .overloaded type=kotlin.String operator=null
|
||||||
s: TYPE_OP operator=IMPLICIT_CAST typeOperand=kotlin.String
|
s: TYPE_OP operator=IMPLICIT_CAST typeOperand=kotlin.String
|
||||||
@@ -56,7 +56,7 @@ IrFile /smartCasts.kt
|
|||||||
if: TYPE_OP operator=NOT_INSTANCEOF typeOperand=kotlin.String
|
if: TYPE_OP operator=NOT_INSTANCEOF typeOperand=kotlin.String
|
||||||
GET_VAR x type=kotlin.Any operator=null
|
GET_VAR x type=kotlin.Any operator=null
|
||||||
then: RETURN type=<no-type>
|
then: RETURN type=<no-type>
|
||||||
LITERAL String type=kotlin.String value=''
|
CONST String type=kotlin.String value=''
|
||||||
RETURN type=<no-type>
|
RETURN type=<no-type>
|
||||||
TYPE_OP operator=IMPLICIT_CAST typeOperand=kotlin.String
|
TYPE_OP operator=IMPLICIT_CAST typeOperand=kotlin.String
|
||||||
GET_VAR x type=kotlin.Any operator=null
|
GET_VAR x type=kotlin.Any operator=null
|
||||||
|
|||||||
@@ -5,12 +5,12 @@ IrFile /smartCastsWithDestructuring.kt
|
|||||||
IrExpressionBody
|
IrExpressionBody
|
||||||
BLOCK type=<no-type> hasResult=false operator=null
|
BLOCK type=<no-type> hasResult=false operator=null
|
||||||
RETURN type=<no-type>
|
RETURN type=<no-type>
|
||||||
LITERAL Int type=kotlin.Int value='1'
|
CONST Int type=kotlin.Int value='1'
|
||||||
IrFunction public operator fun I2.component2(): kotlin.String
|
IrFunction public operator fun I2.component2(): kotlin.String
|
||||||
IrExpressionBody
|
IrExpressionBody
|
||||||
BLOCK type=<no-type> hasResult=false operator=null
|
BLOCK type=<no-type> hasResult=false operator=null
|
||||||
RETURN type=<no-type>
|
RETURN type=<no-type>
|
||||||
LITERAL String type=kotlin.String value=''
|
CONST String type=kotlin.String value=''
|
||||||
IrFunction public fun test(/*0*/ x: I1): kotlin.Unit
|
IrFunction public fun test(/*0*/ x: I1): kotlin.Unit
|
||||||
IrExpressionBody
|
IrExpressionBody
|
||||||
BLOCK type=<no-type> hasResult=false operator=null
|
BLOCK type=<no-type> hasResult=false operator=null
|
||||||
|
|||||||
+5
-5
@@ -3,25 +3,25 @@ IrFile /smoke.kt
|
|||||||
IrExpressionBody
|
IrExpressionBody
|
||||||
BLOCK type=<no-type> hasResult=false operator=null
|
BLOCK type=<no-type> hasResult=false operator=null
|
||||||
RETURN type=<no-type>
|
RETURN type=<no-type>
|
||||||
LITERAL String type=kotlin.String value='OK'
|
CONST String type=kotlin.String value='OK'
|
||||||
IrProperty public val testSimpleVal: kotlin.Int = 1 getter=null setter=null
|
IrProperty public val testSimpleVal: kotlin.Int = 1 getter=null setter=null
|
||||||
IrExpressionBody
|
IrExpressionBody
|
||||||
LITERAL Int type=kotlin.Int value='1'
|
CONST Int type=kotlin.Int value='1'
|
||||||
IrProperty public val testValWithGetter: kotlin.Int getter=<get-testValWithGetter> setter=null
|
IrProperty public val testValWithGetter: kotlin.Int getter=<get-testValWithGetter> setter=null
|
||||||
IrPropertyGetter public fun <get-testValWithGetter>(): kotlin.Int property=testValWithGetter
|
IrPropertyGetter public fun <get-testValWithGetter>(): kotlin.Int property=testValWithGetter
|
||||||
IrExpressionBody
|
IrExpressionBody
|
||||||
BLOCK type=<no-type> hasResult=false operator=null
|
BLOCK type=<no-type> hasResult=false operator=null
|
||||||
RETURN type=<no-type>
|
RETURN type=<no-type>
|
||||||
LITERAL Int type=kotlin.Int value='42'
|
CONST Int type=kotlin.Int value='42'
|
||||||
IrProperty public var testSimpleVar: kotlin.Int getter=null setter=null
|
IrProperty public var testSimpleVar: kotlin.Int getter=null setter=null
|
||||||
IrExpressionBody
|
IrExpressionBody
|
||||||
LITERAL Int type=kotlin.Int value='2'
|
CONST Int type=kotlin.Int value='2'
|
||||||
IrProperty public var testVarWithAccessors: kotlin.Int getter=<get-testVarWithAccessors> setter=<set-testVarWithAccessors>
|
IrProperty public var testVarWithAccessors: kotlin.Int getter=<get-testVarWithAccessors> setter=<set-testVarWithAccessors>
|
||||||
IrPropertyGetter public fun <get-testVarWithAccessors>(): kotlin.Int property=testVarWithAccessors
|
IrPropertyGetter public fun <get-testVarWithAccessors>(): kotlin.Int property=testVarWithAccessors
|
||||||
IrExpressionBody
|
IrExpressionBody
|
||||||
BLOCK type=<no-type> hasResult=false operator=null
|
BLOCK type=<no-type> hasResult=false operator=null
|
||||||
RETURN type=<no-type>
|
RETURN type=<no-type>
|
||||||
LITERAL Int type=kotlin.Int value='42'
|
CONST Int type=kotlin.Int value='42'
|
||||||
IrPropertySetter public fun <set-testVarWithAccessors>(/*0*/ v: kotlin.Int): kotlin.Unit property=testVarWithAccessors
|
IrPropertySetter public fun <set-testVarWithAccessors>(/*0*/ v: kotlin.Int): kotlin.Unit property=testVarWithAccessors
|
||||||
IrExpressionBody
|
IrExpressionBody
|
||||||
BLOCK type=<no-type> hasResult=false operator=null
|
BLOCK type=<no-type> hasResult=false operator=null
|
||||||
|
|||||||
+3
-3
@@ -12,7 +12,7 @@ IrFile /stringPlus.kt
|
|||||||
RETURN type=<no-type>
|
RETURN type=<no-type>
|
||||||
STRING_CONCATENATION type=kotlin.String
|
STRING_CONCATENATION type=kotlin.String
|
||||||
GET_VAR a type=kotlin.String operator=null
|
GET_VAR a type=kotlin.String operator=null
|
||||||
LITERAL String type=kotlin.String value='+'
|
CONST String type=kotlin.String value='+'
|
||||||
GET_VAR b type=kotlin.Int operator=null
|
GET_VAR b type=kotlin.Int operator=null
|
||||||
IrFunction public fun test3(/*0*/ a: kotlin.String, /*1*/ b: kotlin.Int): kotlin.String
|
IrFunction public fun test3(/*0*/ a: kotlin.String, /*1*/ b: kotlin.Int): kotlin.String
|
||||||
IrExpressionBody
|
IrExpressionBody
|
||||||
@@ -20,8 +20,8 @@ IrFile /stringPlus.kt
|
|||||||
RETURN type=<no-type>
|
RETURN type=<no-type>
|
||||||
STRING_CONCATENATION type=kotlin.String
|
STRING_CONCATENATION type=kotlin.String
|
||||||
GET_VAR a type=kotlin.String operator=null
|
GET_VAR a type=kotlin.String operator=null
|
||||||
LITERAL String type=kotlin.String value='+'
|
CONST String type=kotlin.String value='+'
|
||||||
CALL .plus type=kotlin.Int operator=PLUS
|
CALL .plus type=kotlin.Int operator=PLUS
|
||||||
$this: GET_VAR b type=kotlin.Int operator=null
|
$this: GET_VAR b type=kotlin.Int operator=null
|
||||||
other: LITERAL Int type=kotlin.Int value='1'
|
other: CONST Int type=kotlin.Int value='1'
|
||||||
GET_VAR a type=kotlin.String operator=null
|
GET_VAR a type=kotlin.String operator=null
|
||||||
|
|||||||
+1
-1
@@ -3,7 +3,7 @@ IrFile /values.kt
|
|||||||
DUMMY A
|
DUMMY A
|
||||||
IrProperty public val a: kotlin.Int = 0 getter=null setter=null
|
IrProperty public val a: kotlin.Int = 0 getter=null setter=null
|
||||||
IrExpressionBody
|
IrExpressionBody
|
||||||
LITERAL Int type=kotlin.Int value='0'
|
CONST Int type=kotlin.Int value='0'
|
||||||
DUMMY Z
|
DUMMY Z
|
||||||
IrFunction public fun test1(): Enum
|
IrFunction public fun test1(): Enum
|
||||||
IrExpressionBody
|
IrExpressionBody
|
||||||
|
|||||||
Vendored
+31
-31
@@ -10,21 +10,21 @@ IrFile /when.kt
|
|||||||
WHEN type=kotlin.String operator=WHEN
|
WHEN type=kotlin.String operator=WHEN
|
||||||
if: CALL .EQEQ type=kotlin.Boolean operator=EQEQ
|
if: CALL .EQEQ type=kotlin.Boolean operator=EQEQ
|
||||||
arg0: GET_VAR tmp0_subject type=kotlin.Any? operator=null
|
arg0: GET_VAR tmp0_subject type=kotlin.Any? operator=null
|
||||||
arg1: LITERAL Null type=kotlin.Nothing? value='null'
|
arg1: CONST Null type=kotlin.Nothing? value='null'
|
||||||
then: LITERAL String type=kotlin.String value='null'
|
then: CONST String type=kotlin.String value='null'
|
||||||
if: CALL .EQEQ type=kotlin.Boolean operator=EQEQ
|
if: CALL .EQEQ type=kotlin.Boolean operator=EQEQ
|
||||||
arg0: GET_VAR tmp0_subject type=kotlin.Any? operator=null
|
arg0: GET_VAR tmp0_subject type=kotlin.Any? operator=null
|
||||||
arg1: GET_OBJECT A type=A
|
arg1: GET_OBJECT A type=A
|
||||||
then: LITERAL String type=kotlin.String value='A'
|
then: CONST String type=kotlin.String value='A'
|
||||||
if: TYPE_OP operator=INSTANCEOF typeOperand=kotlin.String
|
if: TYPE_OP operator=INSTANCEOF typeOperand=kotlin.String
|
||||||
GET_VAR tmp0_subject type=kotlin.Any? operator=null
|
GET_VAR tmp0_subject type=kotlin.Any? operator=null
|
||||||
then: LITERAL String type=kotlin.String value='String'
|
then: CONST String type=kotlin.String value='String'
|
||||||
if: CALL .contains type=kotlin.Boolean operator=IN
|
if: CALL .contains type=kotlin.Boolean operator=IN
|
||||||
$receiver: CALL .setOf type=kotlin.collections.Set<kotlin.Nothing> operator=null
|
$receiver: CALL .setOf type=kotlin.collections.Set<kotlin.Nothing> operator=null
|
||||||
element: TYPE_OP operator=IMPLICIT_CAST typeOperand=kotlin.Any
|
element: TYPE_OP operator=IMPLICIT_CAST typeOperand=kotlin.Any
|
||||||
GET_VAR tmp0_subject type=kotlin.Any? operator=null
|
GET_VAR tmp0_subject type=kotlin.Any? operator=null
|
||||||
then: LITERAL String type=kotlin.String value='nothingness?'
|
then: CONST String type=kotlin.String value='nothingness?'
|
||||||
else: LITERAL String type=kotlin.String value='something'
|
else: CONST String type=kotlin.String value='something'
|
||||||
IrFunction public fun test(/*0*/ x: kotlin.Any?): kotlin.String
|
IrFunction public fun test(/*0*/ x: kotlin.Any?): kotlin.String
|
||||||
IrExpressionBody
|
IrExpressionBody
|
||||||
BLOCK type=<no-type> hasResult=false operator=null
|
BLOCK type=<no-type> hasResult=false operator=null
|
||||||
@@ -32,21 +32,21 @@ IrFile /when.kt
|
|||||||
WHEN type=kotlin.String operator=WHEN
|
WHEN type=kotlin.String operator=WHEN
|
||||||
if: CALL .EQEQ type=kotlin.Boolean operator=EQEQ
|
if: CALL .EQEQ type=kotlin.Boolean operator=EQEQ
|
||||||
arg0: GET_VAR x type=kotlin.Any? operator=null
|
arg0: GET_VAR x type=kotlin.Any? operator=null
|
||||||
arg1: LITERAL Null type=kotlin.Nothing? value='null'
|
arg1: CONST Null type=kotlin.Nothing? value='null'
|
||||||
then: LITERAL String type=kotlin.String value='null'
|
then: CONST String type=kotlin.String value='null'
|
||||||
if: CALL .EQEQ type=kotlin.Boolean operator=EQEQ
|
if: CALL .EQEQ type=kotlin.Boolean operator=EQEQ
|
||||||
arg0: GET_VAR x type=kotlin.Any? operator=null
|
arg0: GET_VAR x type=kotlin.Any? operator=null
|
||||||
arg1: GET_OBJECT A type=A
|
arg1: GET_OBJECT A type=A
|
||||||
then: LITERAL String type=kotlin.String value='A'
|
then: CONST String type=kotlin.String value='A'
|
||||||
if: TYPE_OP operator=INSTANCEOF typeOperand=kotlin.String
|
if: TYPE_OP operator=INSTANCEOF typeOperand=kotlin.String
|
||||||
GET_VAR x type=kotlin.Any? operator=null
|
GET_VAR x type=kotlin.Any? operator=null
|
||||||
then: LITERAL String type=kotlin.String value='String'
|
then: CONST String type=kotlin.String value='String'
|
||||||
if: CALL .contains type=kotlin.Boolean operator=IN
|
if: CALL .contains type=kotlin.Boolean operator=IN
|
||||||
$receiver: CALL .setOf type=kotlin.collections.Set<kotlin.Nothing> operator=null
|
$receiver: CALL .setOf type=kotlin.collections.Set<kotlin.Nothing> operator=null
|
||||||
element: TYPE_OP operator=IMPLICIT_CAST typeOperand=kotlin.Any
|
element: TYPE_OP operator=IMPLICIT_CAST typeOperand=kotlin.Any
|
||||||
GET_VAR x type=kotlin.Any? operator=null
|
GET_VAR x type=kotlin.Any? operator=null
|
||||||
then: LITERAL String type=kotlin.String value='nothingness?'
|
then: CONST String type=kotlin.String value='nothingness?'
|
||||||
else: LITERAL String type=kotlin.String value='something'
|
else: CONST String type=kotlin.String value='something'
|
||||||
IrFunction public fun testComma(/*0*/ x: kotlin.Int): kotlin.String
|
IrFunction public fun testComma(/*0*/ x: kotlin.Int): kotlin.String
|
||||||
IrExpressionBody
|
IrExpressionBody
|
||||||
BLOCK type=<no-type> hasResult=false operator=null
|
BLOCK type=<no-type> hasResult=false operator=null
|
||||||
@@ -60,41 +60,41 @@ IrFile /when.kt
|
|||||||
if: WHEN type=kotlin.Boolean operator=WHEN_COMMA
|
if: WHEN type=kotlin.Boolean operator=WHEN_COMMA
|
||||||
if: CALL .EQEQ type=kotlin.Boolean operator=EQEQ
|
if: CALL .EQEQ type=kotlin.Boolean operator=EQEQ
|
||||||
arg0: GET_VAR tmp0_subject type=kotlin.Int operator=null
|
arg0: GET_VAR tmp0_subject type=kotlin.Int operator=null
|
||||||
arg1: LITERAL Int type=kotlin.Int value='1'
|
arg1: CONST Int type=kotlin.Int value='1'
|
||||||
then: LITERAL Boolean type=kotlin.Boolean value='true'
|
then: CONST Boolean type=kotlin.Boolean value='true'
|
||||||
else: CALL .EQEQ type=kotlin.Boolean operator=EQEQ
|
else: CALL .EQEQ type=kotlin.Boolean operator=EQEQ
|
||||||
arg0: GET_VAR tmp0_subject type=kotlin.Int operator=null
|
arg0: GET_VAR tmp0_subject type=kotlin.Int operator=null
|
||||||
arg1: LITERAL Int type=kotlin.Int value='2'
|
arg1: CONST Int type=kotlin.Int value='2'
|
||||||
then: LITERAL Boolean type=kotlin.Boolean value='true'
|
then: CONST Boolean type=kotlin.Boolean value='true'
|
||||||
else: CALL .EQEQ type=kotlin.Boolean operator=EQEQ
|
else: CALL .EQEQ type=kotlin.Boolean operator=EQEQ
|
||||||
arg0: GET_VAR tmp0_subject type=kotlin.Int operator=null
|
arg0: GET_VAR tmp0_subject type=kotlin.Int operator=null
|
||||||
arg1: LITERAL Int type=kotlin.Int value='3'
|
arg1: CONST Int type=kotlin.Int value='3'
|
||||||
then: LITERAL Boolean type=kotlin.Boolean value='true'
|
then: CONST Boolean type=kotlin.Boolean value='true'
|
||||||
else: CALL .EQEQ type=kotlin.Boolean operator=EQEQ
|
else: CALL .EQEQ type=kotlin.Boolean operator=EQEQ
|
||||||
arg0: GET_VAR tmp0_subject type=kotlin.Int operator=null
|
arg0: GET_VAR tmp0_subject type=kotlin.Int operator=null
|
||||||
arg1: LITERAL Int type=kotlin.Int value='4'
|
arg1: CONST Int type=kotlin.Int value='4'
|
||||||
then: LITERAL String type=kotlin.String value='1234'
|
then: CONST String type=kotlin.String value='1234'
|
||||||
if: WHEN type=kotlin.Boolean operator=WHEN_COMMA
|
if: WHEN type=kotlin.Boolean operator=WHEN_COMMA
|
||||||
if: WHEN type=kotlin.Boolean operator=WHEN_COMMA
|
if: WHEN type=kotlin.Boolean operator=WHEN_COMMA
|
||||||
if: CALL .EQEQ type=kotlin.Boolean operator=EQEQ
|
if: CALL .EQEQ type=kotlin.Boolean operator=EQEQ
|
||||||
arg0: GET_VAR tmp0_subject type=kotlin.Int operator=null
|
arg0: GET_VAR tmp0_subject type=kotlin.Int operator=null
|
||||||
arg1: LITERAL Int type=kotlin.Int value='5'
|
arg1: CONST Int type=kotlin.Int value='5'
|
||||||
then: LITERAL Boolean type=kotlin.Boolean value='true'
|
then: CONST Boolean type=kotlin.Boolean value='true'
|
||||||
else: CALL .EQEQ type=kotlin.Boolean operator=EQEQ
|
else: CALL .EQEQ type=kotlin.Boolean operator=EQEQ
|
||||||
arg0: GET_VAR tmp0_subject type=kotlin.Int operator=null
|
arg0: GET_VAR tmp0_subject type=kotlin.Int operator=null
|
||||||
arg1: LITERAL Int type=kotlin.Int value='6'
|
arg1: CONST Int type=kotlin.Int value='6'
|
||||||
then: LITERAL Boolean type=kotlin.Boolean value='true'
|
then: CONST Boolean type=kotlin.Boolean value='true'
|
||||||
else: CALL .EQEQ type=kotlin.Boolean operator=EQEQ
|
else: CALL .EQEQ type=kotlin.Boolean operator=EQEQ
|
||||||
arg0: GET_VAR tmp0_subject type=kotlin.Int operator=null
|
arg0: GET_VAR tmp0_subject type=kotlin.Int operator=null
|
||||||
arg1: LITERAL Int type=kotlin.Int value='7'
|
arg1: CONST Int type=kotlin.Int value='7'
|
||||||
then: LITERAL String type=kotlin.String value='567'
|
then: CONST String type=kotlin.String value='567'
|
||||||
if: WHEN type=kotlin.Boolean operator=WHEN_COMMA
|
if: WHEN type=kotlin.Boolean operator=WHEN_COMMA
|
||||||
if: CALL .EQEQ type=kotlin.Boolean operator=EQEQ
|
if: CALL .EQEQ type=kotlin.Boolean operator=EQEQ
|
||||||
arg0: GET_VAR tmp0_subject type=kotlin.Int operator=null
|
arg0: GET_VAR tmp0_subject type=kotlin.Int operator=null
|
||||||
arg1: LITERAL Int type=kotlin.Int value='8'
|
arg1: CONST Int type=kotlin.Int value='8'
|
||||||
then: LITERAL Boolean type=kotlin.Boolean value='true'
|
then: CONST Boolean type=kotlin.Boolean value='true'
|
||||||
else: CALL .EQEQ type=kotlin.Boolean operator=EQEQ
|
else: CALL .EQEQ type=kotlin.Boolean operator=EQEQ
|
||||||
arg0: GET_VAR tmp0_subject type=kotlin.Int operator=null
|
arg0: GET_VAR tmp0_subject type=kotlin.Int operator=null
|
||||||
arg1: LITERAL Int type=kotlin.Int value='9'
|
arg1: CONST Int type=kotlin.Int value='9'
|
||||||
then: LITERAL String type=kotlin.String value='89'
|
then: CONST String type=kotlin.String value='89'
|
||||||
else: LITERAL String type=kotlin.String value='?'
|
else: CONST String type=kotlin.String value='?'
|
||||||
|
|||||||
@@ -161,6 +161,12 @@ public class IrTextTestCaseGenerated extends AbstractIrTextTestCase {
|
|||||||
doTest(fileName);
|
doTest(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("literals.kt")
|
||||||
|
public void testLiterals() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/ir/irText/literals.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("primitiveComparisons.kt")
|
@TestMetadata("primitiveComparisons.kt")
|
||||||
public void testPrimitiveComparisons() throws Exception {
|
public void testPrimitiveComparisons() throws Exception {
|
||||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/ir/irText/primitiveComparisons.kt");
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/ir/irText/primitiveComparisons.kt");
|
||||||
@@ -179,6 +185,12 @@ public class IrTextTestCaseGenerated extends AbstractIrTextTestCase {
|
|||||||
doTest(fileName);
|
doTest(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("simpleUnaryOperators.kt")
|
||||||
|
public void testSimpleUnaryOperators() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/ir/irText/simpleUnaryOperators.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("smartCasts.kt")
|
@TestMetadata("smartCasts.kt")
|
||||||
public void testSmartCasts() throws Exception {
|
public void testSmartCasts() throws Exception {
|
||||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/ir/irText/smartCasts.kt");
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/ir/irText/smartCasts.kt");
|
||||||
|
|||||||
Reference in New Issue
Block a user