Shrinking IR: GetProperty / SetProperty expressions are now generated as calls.

This commit is contained in:
Dmitry Petrov
2016-08-19 16:22:43 +03:00
committed by Dmitry Petrov
parent 8500f5ddb2
commit 70dfb75f82
22 changed files with 233 additions and 256 deletions
@@ -95,25 +95,30 @@ class CallGenerator(val statementGenerator: StatementGenerator) : IrGenerator {
superQualifier: ClassDescriptor? = null superQualifier: ClassDescriptor? = null
): IrExpression { ): IrExpression {
val descriptor = resolvedCall.resultingDescriptor val descriptor = resolvedCall.resultingDescriptor
val returnType = getReturnType(resolvedCall)
return when (descriptor) { return when (descriptor) {
is PropertyDescriptor -> is PropertyDescriptor ->
IrGetPropertyExpressionImpl( generatePropertyGetterCall(descriptor, ktElement, resolvedCall)
ktElement.startOffset, ktElement.endOffset,
returnType,
resolvedCall.call.isSafeCall(), descriptor
).apply {
dispatchReceiver = generateReceiver(ktElement, resolvedCall.dispatchReceiver, descriptor.dispatchReceiverParameter)
extensionReceiver = generateReceiver(ktElement, resolvedCall.extensionReceiver, descriptor.extensionReceiverParameter)
}
is FunctionDescriptor -> is FunctionDescriptor ->
generateFunctionCall(descriptor, ktElement, returnType, operator, resolvedCall, superQualifier) generateFunctionCall(descriptor, ktElement, operator, resolvedCall, superQualifier)
else -> else ->
TODO("Unexpected callable descriptor: $descriptor ${descriptor.javaClass.simpleName}") TODO("Unexpected callable descriptor: $descriptor ${descriptor.javaClass.simpleName}")
} }
} }
private fun CallGenerator.generatePropertyGetterCall(
descriptor: PropertyDescriptor,
ktElement: KtElement,
resolvedCall: ResolvedCall<*>
): IrGetterCallExpressionImpl {
val returnType = getReturnType(resolvedCall)
val dispatchReceiver = generateReceiver(ktElement, resolvedCall.dispatchReceiver, descriptor.dispatchReceiverParameter)
val extensionReceiver = generateReceiver(ktElement, resolvedCall.extensionReceiver, descriptor.extensionReceiverParameter)
return IrGetterCallExpressionImpl(ktElement.startOffset, ktElement.endOffset,
returnType, descriptor.getter!!, resolvedCall.call.isSafeCall(),
dispatchReceiver, extensionReceiver, IrOperator.GET_PROPERTY)
}
private fun ResolvedCall<*>.requiresArgumentReordering(): Boolean { private fun ResolvedCall<*>.requiresArgumentReordering(): Boolean {
var lastValueParameterIndex = -1 var lastValueParameterIndex = -1
for (valueArgument in call.valueArguments) { for (valueArgument in call.valueArguments) {
@@ -131,20 +136,21 @@ class CallGenerator(val statementGenerator: StatementGenerator) : IrGenerator {
private fun generateFunctionCall( private fun generateFunctionCall(
descriptor: FunctionDescriptor, descriptor: FunctionDescriptor,
ktElement: KtElement, ktElement: KtElement,
resultType: KotlinType?,
operator: IrOperator?, operator: IrOperator?,
resolvedCall: ResolvedCall<out CallableDescriptor>, resolvedCall: ResolvedCall<out CallableDescriptor>,
superQualifier: ClassDescriptor? superQualifier: ClassDescriptor?
): IrExpression { ): IrExpression {
val returnType = descriptor.returnType
val irCall = IrCallExpressionImpl( val irCall = IrCallExpressionImpl(
ktElement.startOffset, ktElement.endOffset, resultType, ktElement.startOffset, ktElement.endOffset, returnType,
descriptor, resolvedCall.call.isSafeCall(), operator, superQualifier descriptor, resolvedCall.call.isSafeCall(), operator, superQualifier
) )
irCall.dispatchReceiver = generateReceiver(ktElement, resolvedCall.dispatchReceiver, descriptor.dispatchReceiverParameter) irCall.dispatchReceiver = generateReceiver(ktElement, resolvedCall.dispatchReceiver, descriptor.dispatchReceiverParameter)
irCall.extensionReceiver = generateReceiver(ktElement, resolvedCall.extensionReceiver, descriptor.extensionReceiverParameter) irCall.extensionReceiver = generateReceiver(ktElement, resolvedCall.extensionReceiver, descriptor.extensionReceiverParameter)
return if (resolvedCall.requiresArgumentReordering()) { return if (resolvedCall.requiresArgumentReordering()) {
generateCallWithArgumentReordering(irCall, ktElement, resolvedCall, resultType) generateCallWithArgumentReordering(irCall, ktElement, resolvedCall, returnType)
} }
else { else {
irCall.apply { irCall.apply {
@@ -17,13 +17,12 @@
package org.jetbrains.kotlin.psi2ir.generators package org.jetbrains.kotlin.psi2ir.generators
import com.intellij.psi.tree.IElementType import com.intellij.psi.tree.IElementType
import org.jetbrains.kotlin.ir.expressions.IrBinaryOperator
import org.jetbrains.kotlin.ir.expressions.IrOperator import org.jetbrains.kotlin.ir.expressions.IrOperator
import org.jetbrains.kotlin.ir.expressions.IrTypeOperator import org.jetbrains.kotlin.ir.expressions.IrTypeOperator
import org.jetbrains.kotlin.lexer.KtTokens import org.jetbrains.kotlin.lexer.KtTokens
fun getIrBinaryOperator(ktOperator: IElementType): IrBinaryOperator? = fun getIrBinaryOperator(ktOperator: IElementType): IrOperator? =
when (ktOperator) { when (ktOperator) {
KtTokens.EQ -> IrOperator.EQ KtTokens.EQ -> IrOperator.EQ
KtTokens.PLUSEQ -> IrOperator.PLUSEQ KtTokens.PLUSEQ -> IrOperator.PLUSEQ
@@ -114,7 +114,7 @@ class OperatorExpressionGenerator(val statementGenerator: StatementGenerator): I
) )
} }
private fun generateBinaryBooleanOperator(expression: KtBinaryExpression, irOperator: IrBinaryOperator): IrExpression { private fun generateBinaryBooleanOperator(expression: KtBinaryExpression, irOperator: IrOperator): IrExpression {
val irArgument0 = statementGenerator.generateExpression(expression.left!!).toExpectedType(context.builtIns.booleanType) val irArgument0 = statementGenerator.generateExpression(expression.left!!).toExpectedType(context.builtIns.booleanType)
val irArgument1 = statementGenerator.generateExpression(expression.right!!).toExpectedType(context.builtIns.booleanType) val irArgument1 = statementGenerator.generateExpression(expression.right!!).toExpectedType(context.builtIns.booleanType)
return IrBinaryOperatorExpressionImpl( return IrBinaryOperatorExpressionImpl(
@@ -135,7 +135,7 @@ class OperatorExpressionGenerator(val statementGenerator: StatementGenerator): I
IrOperator.EXCL, null, irOperatorCall) IrOperator.EXCL, null, irOperatorCall)
} }
private fun generateIdentityOperator(expression: KtBinaryExpression, irOperator: IrBinaryOperator): IrExpression { private fun generateIdentityOperator(expression: KtBinaryExpression, irOperator: IrOperator): IrExpression {
val irArgument0 = statementGenerator.generateExpression(expression.left!!) val irArgument0 = statementGenerator.generateExpression(expression.left!!)
val irArgument1 = statementGenerator.generateExpression(expression.right!!) val irArgument1 = statementGenerator.generateExpression(expression.right!!)
return IrBinaryOperatorExpressionImpl( return IrBinaryOperatorExpressionImpl(
@@ -144,7 +144,7 @@ class OperatorExpressionGenerator(val statementGenerator: StatementGenerator): I
) )
} }
private fun generateEqualityOperator(expression: KtBinaryExpression, irOperator: IrBinaryOperator): IrExpression { private fun generateEqualityOperator(expression: KtBinaryExpression, irOperator: IrOperator): IrExpression {
val relatedCall = getResolvedCall(expression)!! val relatedCall = getResolvedCall(expression)!!
val relatedDescriptor = relatedCall.resultingDescriptor val relatedDescriptor = relatedCall.resultingDescriptor
@@ -169,7 +169,7 @@ class OperatorExpressionGenerator(val statementGenerator: StatementGenerator): I
) )
} }
private fun generateComparisonOperator(expression: KtBinaryExpression, irOperator: IrBinaryOperator): IrExpression { private fun generateComparisonOperator(expression: KtBinaryExpression, irOperator: IrOperator): IrExpression {
val compareToCall = getResolvedCall(expression)!! val compareToCall = getResolvedCall(expression)!!
val compareToDescriptor = compareToCall.resultingDescriptor val compareToDescriptor = compareToCall.resultingDescriptor
@@ -35,21 +35,21 @@ class PropertyLValue(
override val type: KotlinType? override val type: KotlinType?
get() = descriptor.type get() = descriptor.type
private fun IrPropertyAccessExpression.setReceivers() = override fun load(): IrExpression {
apply { val getter = descriptor.getter!!
dispatchReceiver = this@PropertyLValue.dispatchReceiver return IrGetterCallExpressionImpl(
extensionReceiver = this@PropertyLValue.extensionReceiver ktElement.startOffset, ktElement.endOffset,
} getter.returnType, getter, isSafe,
dispatchReceiver, extensionReceiver, IrOperator.GET_PROPERTY
)
}
override fun load(): IrExpression = override fun store(irExpression: IrExpression): IrExpression {
IrGetPropertyExpressionImpl( val setter = descriptor.setter!!
ktElement.startOffset, ktElement.endOffset, val irArgument = irExpression.toExpectedType(descriptor.type)
descriptor.type, isSafe, descriptor, irOperator val irCall = IrSetterCallExpressionImpl(ktElement.startOffset, ktElement.endOffset,
).setReceivers() setter.returnType, setter, isSafe,
dispatchReceiver, extensionReceiver, irArgument, irOperator)
override fun store(irExpression: IrExpression): IrExpression = return irCall
IrSetPropertyExpressionImpl( }
ktElement.startOffset, ktElement.endOffset,
isSafe, descriptor, irExpression.toExpectedType(descriptor.type), irOperator
).setReceivers()
} }
@@ -30,3 +30,4 @@ const val WHEN_ELSE_EXPRESSION_SLOT = -2
const val BRANCH_RESULT_SLOT = -1 const val BRANCH_RESULT_SLOT = -1
const val LOOP_BODY_SLOT = -1 const val LOOP_BODY_SLOT = -1
const val LOOP_CONDITION_SLOT = -2 const val LOOP_CONDITION_SLOT = -2
const val SETTER_ARGUMENT_INDEX = 0
@@ -38,7 +38,7 @@ class IrCallExpressionImpl(
type: KotlinType?, type: KotlinType?,
override val descriptor: CallableDescriptor, override val descriptor: CallableDescriptor,
isSafe: Boolean, isSafe: Boolean,
override val operator: IrOperator?, override val operator: IrOperator? = null,
override val superQualifier: ClassDescriptor? = null override val superQualifier: ClassDescriptor? = null
) : IrMemberAccessExpressionBase(startOffset, endOffset, type, isSafe), IrCallExpression { ) : IrMemberAccessExpressionBase(startOffset, endOffset, type, isSafe), IrCallExpression {
private val argumentsByParameterIndex = private val argumentsByParameterIndex =
@@ -83,3 +83,98 @@ class IrCallExpressionImpl(
argumentsByParameterIndex.forEach { it?.accept(visitor, data) } argumentsByParameterIndex.forEach { it?.accept(visitor, data) }
} }
} }
abstract class IrPropertyAccessorCallExpressionBase(
startOffset: Int,
endOffset: Int,
type: KotlinType?,
override val descriptor: CallableDescriptor,
isSafe: Boolean,
override val operator: IrOperator? = null,
override val superQualifier: ClassDescriptor? = null
) : IrMemberAccessExpressionBase(startOffset, endOffset, type, isSafe), IrCallExpression {
override fun <R, D> accept(visitor: IrElementVisitor<R, D>, data: D): R {
return visitor.visitCallExpression(this, data)
}
}
class IrGetterCallExpressionImpl(
startOffset: Int,
endOffset: Int,
type: KotlinType?,
descriptor: CallableDescriptor,
isSafe: Boolean,
operator: IrOperator? = null,
superQualifier: ClassDescriptor? = null
) : IrPropertyAccessorCallExpressionBase(startOffset, endOffset, type, descriptor, isSafe, operator, superQualifier), IrCallExpression {
constructor(
startOffset: Int,
endOffset: Int,
type: KotlinType?,
descriptor: CallableDescriptor,
isSafe: Boolean,
dispatchReceiver: IrExpression?,
extensionReceiver: IrExpression?,
operator: IrOperator? = null,
superQualifier: ClassDescriptor? = null
) : this(startOffset, endOffset, type, descriptor, isSafe, operator, superQualifier) {
this.dispatchReceiver = dispatchReceiver
this.extensionReceiver = extensionReceiver
}
override fun getArgument(index: Int): IrExpression? = null
override fun putArgument(index: Int, valueArgument: IrExpression?) {
throw UnsupportedOperationException("Property setter call has no arguments")
}
override fun removeArgument(index: Int) {
throw UnsupportedOperationException("Property getter call has no arguments")
}
}
class IrSetterCallExpressionImpl(
startOffset: Int,
endOffset: Int,
type: KotlinType?,
descriptor: CallableDescriptor,
isSafe: Boolean,
operator: IrOperator? = null,
superQualifier: ClassDescriptor? = null
) : IrPropertyAccessorCallExpressionBase(startOffset, endOffset, type, descriptor, isSafe, operator, superQualifier), IrCallExpression {
constructor(
startOffset: Int,
endOffset: Int,
type: KotlinType?,
descriptor: CallableDescriptor,
isSafe: Boolean,
dispatchReceiver: IrExpression?,
extensionReceiver: IrExpression?,
argument: IrExpression,
operator: IrOperator? = null,
superQualifier: ClassDescriptor? = null
) : this(startOffset, endOffset, type, descriptor, isSafe, operator, superQualifier) {
this.dispatchReceiver = dispatchReceiver
this.extensionReceiver = extensionReceiver
putArgument(SETTER_ARGUMENT_INDEX, argument)
}
private var argumentImpl: IrExpression? = null
override fun getArgument(index: Int): IrExpression? =
if (index == SETTER_ARGUMENT_INDEX) argumentImpl!! else null
override fun putArgument(index: Int, valueArgument: IrExpression?) {
if (index != SETTER_ARGUMENT_INDEX) return
argumentImpl?.detach()
valueArgument?.assertDetached()
argumentImpl = valueArgument
valueArgument?.setTreeLocation(this, SETTER_ARGUMENT_INDEX)
}
override fun removeArgument(index: Int) {
if (index != SETTER_ARGUMENT_INDEX) return
argumentImpl?.detach()
argumentImpl = null
}
}
@@ -16,20 +16,20 @@
package org.jetbrains.kotlin.ir.expressions package org.jetbrains.kotlin.ir.expressions
import org.jetbrains.kotlin.descriptors.CallableDescriptor import org.jetbrains.kotlin.descriptors.ReceiverParameterDescriptor
import org.jetbrains.kotlin.ir.visitors.IrElementVisitor import org.jetbrains.kotlin.ir.visitors.IrElementVisitor
import org.jetbrains.kotlin.types.KotlinType import org.jetbrains.kotlin.types.KotlinType
interface IrGetExtensionReceiverExpression : IrDeclarationReference { interface IrGetExtensionReceiverExpression : IrDeclarationReference {
override val descriptor: CallableDescriptor override val descriptor: ReceiverParameterDescriptor
} }
class IrGetExtensionReceiverExpressionImpl( class IrGetExtensionReceiverExpressionImpl(
startOffset: Int, startOffset: Int,
endOffset: Int, endOffset: Int,
type: KotlinType?, type: KotlinType?,
descriptor: CallableDescriptor descriptor: ReceiverParameterDescriptor
) : IrTerminalDeclarationReferenceBase<CallableDescriptor>(startOffset, endOffset, type, descriptor), IrGetExtensionReceiverExpression { ) : IrTerminalDeclarationReferenceBase<ReceiverParameterDescriptor>(startOffset, endOffset, type, descriptor), IrGetExtensionReceiverExpression {
override fun <R, D> accept(visitor: IrElementVisitor<R, D>, data: D): R = override fun <R, D> accept(visitor: IrElementVisitor<R, D>, data: D): R =
visitor.visitGetExtensionReceiver(this, data) visitor.visitGetExtensionReceiver(this, data)
} }
@@ -17,52 +17,59 @@
package org.jetbrains.kotlin.ir.expressions package org.jetbrains.kotlin.ir.expressions
interface IrOperator { interface IrOperator {
object UMINUS : IrOperatorImpl("UMINUS"), IrUnaryOperator abstract class IrOperatorImpl(val debugName: String): IrOperator {
object EXCL : IrOperatorImpl("EXCL"), IrUnaryOperator override fun toString(): String = debugName
object EXCLEXCL : IrOperatorImpl("EXCLEXCL"), IrUnaryOperator }
object IMPLICIT_NOTNULL : IrOperatorImpl("IMPLICIT_NOTNULL"), IrUnaryOperator object UMINUS : IrOperatorImpl("UMINUS")
object EXCL : IrOperatorImpl("EXCL")
object EXCLEXCL : IrOperatorImpl("EXCLEXCL")
object ELVIS : IrOperatorImpl("ELVIS"), IrBinaryOperator object IMPLICIT_NOTNULL : IrOperatorImpl("IMPLICIT_NOTNULL")
object LT : IrOperatorImpl("LT"), IrBinaryOperator object ELVIS : IrOperatorImpl("ELVIS")
object GT : IrOperatorImpl("GT"), IrBinaryOperator
object LTEQ : IrOperatorImpl("LTEQ"), IrBinaryOperator
object GTEQ : IrOperatorImpl("GTEQ"), IrBinaryOperator
object EQEQ : IrOperatorImpl("EQEQ"), IrBinaryOperator object LT : IrOperatorImpl("LT")
object EQEQEQ : IrOperatorImpl("EQEQEQ"), IrBinaryOperator object GT : IrOperatorImpl("GT")
object EXCLEQ : IrOperatorImpl("EXCLEQ"), IrBinaryOperator object LTEQ : IrOperatorImpl("LTEQ")
object EXCLEQEQ : IrOperatorImpl("EXCLEQEQ"), IrBinaryOperator object GTEQ : IrOperatorImpl("GTEQ")
object IN : IrOperatorImpl("IN"), IrBinaryOperator object EQEQ : IrOperatorImpl("EQEQ")
object NOT_IN : IrOperatorImpl("NOT_IN"), IrBinaryOperator object EQEQEQ : IrOperatorImpl("EQEQEQ")
object ANDAND : IrOperatorImpl("ANDAND"), IrBinaryOperator object EXCLEQ : IrOperatorImpl("EXCLEQ")
object OROR : IrOperatorImpl("OROR"), IrBinaryOperator object EXCLEQEQ : IrOperatorImpl("EXCLEQEQ")
object PLUS : IrOperatorImpl("PLUS"), IrBinaryOperator object IN : IrOperatorImpl("IN")
object MINUS : IrOperatorImpl("MINUS"), IrBinaryOperator object NOT_IN : IrOperatorImpl("NOT_IN")
object MUL : IrOperatorImpl("MUL"), IrBinaryOperator object ANDAND : IrOperatorImpl("ANDAND")
object DIV : IrOperatorImpl("DIV"), IrBinaryOperator object OROR : IrOperatorImpl("OROR")
object PERC : IrOperatorImpl("PERC"), IrBinaryOperator
object RANGE : IrOperatorImpl("RANGE"), IrBinaryOperator
object INVOKE : IrOperatorImpl("INVOKE"), IrUnaryOperator object PLUS : IrOperatorImpl("PLUS")
object MINUS : IrOperatorImpl("MINUS")
object MUL : IrOperatorImpl("MUL")
object DIV : IrOperatorImpl("DIV")
object PERC : IrOperatorImpl("PERC")
object RANGE : IrOperatorImpl("RANGE")
object PREFIX_INCR : IrOperatorImpl("PREFIX_INCR"), IrUnaryOperator object INVOKE : IrOperatorImpl("INVOKE")
object PREFIX_DECR : IrOperatorImpl("PREFIX_DECR"), IrUnaryOperator
object POSTFIX_INCR : IrOperatorImpl("POSTFIX_INCR"), IrUnaryOperator
object POSTFIX_DECR : IrOperatorImpl("POSTFIX_DECR"), IrUnaryOperator
object EQ : IrOperatorImpl("EQ"), IrBinaryOperator object PREFIX_INCR : IrOperatorImpl("PREFIX_INCR")
object PLUSEQ : IrOperatorImpl("PLUSEQ"), IrBinaryOperator object PREFIX_DECR : IrOperatorImpl("PREFIX_DECR")
object MINUSEQ : IrOperatorImpl("MINUSEQ"), IrBinaryOperator object POSTFIX_INCR : IrOperatorImpl("POSTFIX_INCR")
object MULTEQ : IrOperatorImpl("MULTEQ"), IrBinaryOperator object POSTFIX_DECR : IrOperatorImpl("POSTFIX_DECR")
object DIVEQ : IrOperatorImpl("DIVEQ"), IrBinaryOperator
object PERCEQ : IrOperatorImpl("PERCEQ"), IrBinaryOperator object EQ : IrOperatorImpl("EQ")
object PLUSEQ : IrOperatorImpl("PLUSEQ")
object MINUSEQ : IrOperatorImpl("MINUSEQ")
object MULTEQ : IrOperatorImpl("MULTEQ")
object DIVEQ : IrOperatorImpl("DIVEQ")
object PERCEQ : IrOperatorImpl("PERCEQ")
object SYNTHETIC_BLOCK : IrOperatorImpl("SYNTHETIC_BLOCK") object SYNTHETIC_BLOCK : IrOperatorImpl("SYNTHETIC_BLOCK")
object GET_PROPERTY : IrOperatorImpl("GET_PROPERTY")
object SET_PROPERTY : IrOperatorImpl("SET_PROPERTY")
data class COMPONENT_N private constructor(val index: Int) : IrOperatorImpl("COMPONENT_$index") { data class COMPONENT_N private constructor(val index: Int) : IrOperatorImpl("COMPONENT_$index") {
companion object { companion object {
private val precreatedComponents = Array(32) { i -> COMPONENT_N(i + 1) } private val precreatedComponents = Array(32) { i -> COMPONENT_N(i + 1) }
@@ -75,10 +82,3 @@ interface IrOperator {
} }
} }
} }
interface IrUnaryOperator : IrOperator
interface IrBinaryOperator : IrOperator
abstract class IrOperatorImpl(val debugName: String): IrOperator {
override fun toString(): String = debugName
}
@@ -27,12 +27,12 @@ interface IrOperatorExpression : IrExpression {
} }
interface IrUnaryOperatorExpression : IrOperatorExpression { interface IrUnaryOperatorExpression : IrOperatorExpression {
override val operator: IrUnaryOperator override val operator: IrOperator
var argument: IrExpression var argument: IrExpression
} }
interface IrBinaryOperatorExpression : IrOperatorExpression { interface IrBinaryOperatorExpression : IrOperatorExpression {
override val operator: IrBinaryOperator override val operator: IrOperator
var argument0: IrExpression var argument0: IrExpression
var argument1: IrExpression var argument1: IrExpression
} }
@@ -41,14 +41,14 @@ class IrUnaryOperatorExpressionImpl(
startOffset: Int, startOffset: Int,
endOffset: Int, endOffset: Int,
type: KotlinType?, type: KotlinType?,
override val operator: IrUnaryOperator, override val operator: IrOperator,
override val relatedDescriptor: CallableDescriptor? override val relatedDescriptor: CallableDescriptor?
) : IrExpressionBase(startOffset, endOffset, type), IrUnaryOperatorExpression { ) : IrExpressionBase(startOffset, endOffset, type), IrUnaryOperatorExpression {
constructor( constructor(
startOffset: Int, startOffset: Int,
endOffset: Int, endOffset: Int,
type: KotlinType?, type: KotlinType?,
operator: IrUnaryOperator, operator: IrOperator,
relatedDescriptor: CallableDescriptor?, relatedDescriptor: CallableDescriptor?,
argument: IrExpression argument: IrExpression
) : this(startOffset, endOffset, type, operator, relatedDescriptor) { ) : this(startOffset, endOffset, type, operator, relatedDescriptor) {
@@ -91,14 +91,14 @@ class IrBinaryOperatorExpressionImpl(
startOffset: Int, startOffset: Int,
endOffset: Int, endOffset: Int,
type: KotlinType?, type: KotlinType?,
override val operator: IrBinaryOperator, override val operator: IrOperator,
override val relatedDescriptor: CallableDescriptor? override val relatedDescriptor: CallableDescriptor?
) : IrExpressionBase(startOffset, endOffset, type), IrBinaryOperatorExpression { ) : IrExpressionBase(startOffset, endOffset, type), IrBinaryOperatorExpression {
constructor( constructor(
startOffset: Int, startOffset: Int,
endOffset: Int, endOffset: Int,
type: KotlinType?, type: KotlinType?,
operator: IrBinaryOperator, operator: IrOperator,
relatedDescriptor: CallableDescriptor?, relatedDescriptor: CallableDescriptor?,
argument0: IrExpression, argument0: IrExpression,
argument1: IrExpression argument1: IrExpression
@@ -1,96 +0,0 @@
/*
* Copyright 2010-2016 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.kotlin.ir.expressions
import org.jetbrains.kotlin.descriptors.PropertyDescriptor
import org.jetbrains.kotlin.ir.*
import org.jetbrains.kotlin.ir.visitors.IrElementVisitor
import org.jetbrains.kotlin.types.KotlinType
interface IrPropertyAccessExpression : IrMemberAccessExpression {
override val descriptor: PropertyDescriptor
val operator: IrOperator?
}
interface IrGetPropertyExpression : IrPropertyAccessExpression
interface IrSetPropertyExpression : IrPropertyAccessExpression {
var value: IrExpression
}
class IrGetPropertyExpressionImpl(
startOffset: Int,
endOffset: Int,
type: KotlinType?,
isSafe: Boolean,
override val descriptor: PropertyDescriptor,
override val operator: IrOperator? = null
) : IrMemberAccessExpressionBase(startOffset, endOffset, type, isSafe), IrGetPropertyExpression {
override fun <R, D> accept(visitor: IrElementVisitor<R, D>, data: D): R =
visitor.visitGetProperty(this, data)
}
class IrSetPropertyExpressionImpl(
startOffset: Int,
endOffset: Int,
isSafe: Boolean,
override val descriptor: PropertyDescriptor,
override val operator: IrOperator? = null
) : IrMemberAccessExpressionBase(startOffset, endOffset, null, isSafe), IrSetPropertyExpression {
constructor(
startOffset: Int,
endOffset: Int,
isSafe: Boolean,
descriptor: PropertyDescriptor,
value: IrExpression,
operator: IrOperator? = null
) : this(startOffset, endOffset, isSafe, descriptor, operator) {
this.value = value
}
private var valueImpl: IrExpression? = null
override var value: IrExpression
get() = valueImpl!!
set(value) {
value.assertDetached()
valueImpl?.detach()
valueImpl = value
value.setTreeLocation(this, ARGUMENT0_SLOT)
}
override fun getChild(slot: Int): IrElement? =
when (slot) {
ARGUMENT0_SLOT -> value
else -> super.getChild(slot)
}
override fun replaceChild(slot: Int, newChild: IrElement) {
when (slot) {
ARGUMENT0_SLOT -> value = newChild.assertCast()
else -> super.replaceChild(slot, newChild)
}
}
override fun <R, D> accept(visitor: IrElementVisitor<R, D>, data: D): R {
return visitor.visitSetProperty(this, data)
}
override fun <D> acceptChildren(visitor: IrElementVisitor<Unit, D>, data: D) {
super.acceptChildren(visitor, data)
value.accept(visitor, data)
}
}
@@ -20,8 +20,6 @@ import org.jetbrains.kotlin.ir.IrElement
import org.jetbrains.kotlin.ir.SourceLocationManager import org.jetbrains.kotlin.ir.SourceLocationManager
import org.jetbrains.kotlin.ir.declarations.IrFile import org.jetbrains.kotlin.ir.declarations.IrFile
import org.jetbrains.kotlin.ir.expressions.IrCallExpression import org.jetbrains.kotlin.ir.expressions.IrCallExpression
import org.jetbrains.kotlin.ir.expressions.IrGetPropertyExpression
import org.jetbrains.kotlin.ir.expressions.IrSetPropertyExpression
import org.jetbrains.kotlin.ir.expressions.IrWhenExpression import org.jetbrains.kotlin.ir.expressions.IrWhenExpression
import org.jetbrains.kotlin.ir.visitors.IrElementVisitor import org.jetbrains.kotlin.ir.visitors.IrElementVisitor
import org.jetbrains.kotlin.utils.Printer import org.jetbrains.kotlin.utils.Printer
@@ -56,21 +54,6 @@ class DumpIrTreeVisitor(out: Appendable): IrElementVisitor<Unit, String> {
} }
} }
override fun visitGetProperty(expression: IrGetPropertyExpression, data: String) {
expression.dumpLabeledElementWith(data) {
expression.dispatchReceiver?.accept(this, "\$this")
expression.extensionReceiver?.accept(this, "\$receiver")
}
}
override fun visitSetProperty(expression: IrSetPropertyExpression, data: String) {
expression.dumpLabeledElementWith(data) {
expression.dispatchReceiver?.accept(this, "\$this")
expression.extensionReceiver?.accept(this, "\$receiver")
expression.value.accept(this, "\$value")
}
}
override fun visitWhenExpression(expression: IrWhenExpression, data: String) { override fun visitWhenExpression(expression: IrWhenExpression, data: String) {
expression.dumpLabeledElementWith(data) { expression.dumpLabeledElementWith(data) {
expression.subject?.let { subject -> expression.subject?.let { subject ->
@@ -79,14 +79,6 @@ class RenderIrElementVisitor : IrElementVisitor<String, Nothing?> {
"CALL ${if (expression.isSafe) "?." else "."}${expression.descriptor.name} " + "CALL ${if (expression.isSafe) "?." else "."}${expression.descriptor.name} " +
"type=${expression.renderType()} operator=${expression.operator}" "type=${expression.renderType()} operator=${expression.operator}"
override fun visitGetProperty(expression: IrGetPropertyExpression, data: Nothing?): String =
"GET_PROPERTY ${if (expression.isSafe) "?." else "."}${expression.descriptor.name} " +
"type=${expression.renderType()} operator=${expression.operator}"
override fun visitSetProperty(expression: IrSetPropertyExpression, data: Nothing?): String =
"SET_PROPERTY ${if (expression.isSafe) "?." else "."}${expression.descriptor.name}" +
"type=${expression.renderType()} operator=${expression.operator}"
override fun visitGetVariable(expression: IrGetVariableExpression, data: Nothing?): String = override fun visitGetVariable(expression: IrGetVariableExpression, data: Nothing?): String =
"GET_VAR ${expression.descriptor.name} type=${expression.renderType()} operator=${expression.operator}" "GET_VAR ${expression.descriptor.name} type=${expression.renderType()} operator=${expression.operator}"
@@ -47,16 +47,13 @@ interface IrElementVisitor<out R, in D> {
fun visitThisExpression(expression: IrThisExpression, data: D) = visitExpression(expression, data) fun visitThisExpression(expression: IrThisExpression, data: D) = visitExpression(expression, data)
fun visitDeclarationReference(expression: IrDeclarationReference, data: D) = visitExpression(expression, data) fun visitDeclarationReference(expression: IrDeclarationReference, data: D) = visitExpression(expression, data)
fun visitGetObjectValue(expression: IrGetObjectValueExpression, data: D) = visitDeclarationReference(expression, data) fun visitSingletonReference(expression: IrGetSingletonValueExpression, data: D) = visitDeclarationReference(expression, data)
fun visitGetEnumValue(expression: IrGetEnumValueExpression, data: D) = visitDeclarationReference(expression, data) fun visitGetObjectValue(expression: IrGetObjectValueExpression, data: D) = visitSingletonReference(expression, data)
fun visitGetEnumValue(expression: IrGetEnumValueExpression, data: D) = visitSingletonReference(expression, data)
fun visitGetVariable(expression: IrGetVariableExpression, data: D) = visitDeclarationReference(expression, data) fun visitGetVariable(expression: IrGetVariableExpression, data: D) = visitDeclarationReference(expression, data)
fun visitSetVariable(expression: IrSetVariableExpression, data: D) = visitDeclarationReference(expression, data) fun visitSetVariable(expression: IrSetVariableExpression, data: D) = visitDeclarationReference(expression, data)
fun visitGetExtensionReceiver(expression: IrGetExtensionReceiverExpression, data: D) = visitDeclarationReference(expression, data) fun visitGetExtensionReceiver(expression: IrGetExtensionReceiverExpression, data: D) = visitDeclarationReference(expression, data)
fun visitMemberAccess(expression: IrMemberAccessExpression, data: D) = visitDeclarationReference(expression, data) fun visitCallExpression(expression: IrCallExpression, data: D) = visitDeclarationReference(expression, data)
fun visitCallExpression(expression: IrCallExpression, data: D) = visitMemberAccess(expression, data)
fun visitPropertyAccess(expression: IrPropertyAccessExpression, data: D) = visitMemberAccess(expression, data)
fun visitGetProperty(expression: IrGetPropertyExpression, data: D) = visitPropertyAccess(expression, data)
fun visitSetProperty(expression: IrSetPropertyExpression, data: D) = visitPropertyAccess(expression, data)
fun visitOperatorExpression(expression: IrOperatorExpression, data: D) = visitExpression(expression, data) fun visitOperatorExpression(expression: IrOperatorExpression, data: D) = visitExpression(expression, data)
fun visitUnaryOperator(expression: IrUnaryOperatorExpression, data: D) = visitOperatorExpression(expression, data) fun visitUnaryOperator(expression: IrUnaryOperatorExpression, data: D) = visitOperatorExpression(expression, data)
+2 -2
View File
@@ -14,6 +14,6 @@ IrFile /assignments.kt
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
SET_PROPERTY .xtype=<no-type> 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
$value: LITERAL Int type=kotlin.Int value='0' <set-?>: LITERAL Int type=kotlin.Int value='0'
+15 -15
View File
@@ -30,23 +30,23 @@ IrFile /augmentedAssignment1.kt
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
SET_PROPERTY .ptype=<no-type> operator=PLUSEQ CALL .<set-p> type=kotlin.Unit operator=PLUSEQ
$value: CALL .plus type=kotlin.Int operator=PLUSEQ <set-?>: CALL .plus type=kotlin.Int operator=PLUSEQ
$this: GET_PROPERTY .p type=kotlin.Int operator=PLUSEQ $this: CALL .<get-p> type=kotlin.Int operator=GET_PROPERTY
other: LITERAL Int type=kotlin.Int value='1' other: LITERAL Int type=kotlin.Int value='1'
SET_PROPERTY .ptype=<no-type> operator=MINUSEQ CALL .<set-p> type=kotlin.Unit operator=MINUSEQ
$value: CALL .minus type=kotlin.Int operator=MINUSEQ <set-?>: CALL .minus type=kotlin.Int operator=MINUSEQ
$this: GET_PROPERTY .p type=kotlin.Int operator=MINUSEQ $this: CALL .<get-p> type=kotlin.Int operator=GET_PROPERTY
other: LITERAL Int type=kotlin.Int value='2' other: LITERAL Int type=kotlin.Int value='2'
SET_PROPERTY .ptype=<no-type> operator=MULTEQ CALL .<set-p> type=kotlin.Unit operator=MULTEQ
$value: CALL .times type=kotlin.Int operator=MULTEQ <set-?>: CALL .times type=kotlin.Int operator=MULTEQ
$this: GET_PROPERTY .p type=kotlin.Int operator=MULTEQ $this: CALL .<get-p> type=kotlin.Int operator=GET_PROPERTY
other: LITERAL Int type=kotlin.Int value='3' other: LITERAL Int type=kotlin.Int value='3'
SET_PROPERTY .ptype=<no-type> operator=DIVEQ CALL .<set-p> type=kotlin.Unit operator=DIVEQ
$value: CALL .div type=kotlin.Int operator=DIVEQ <set-?>: CALL .div type=kotlin.Int operator=DIVEQ
$this: GET_PROPERTY .p type=kotlin.Int operator=DIVEQ $this: CALL .<get-p> type=kotlin.Int operator=GET_PROPERTY
other: LITERAL Int type=kotlin.Int value='4' other: LITERAL Int type=kotlin.Int value='4'
SET_PROPERTY .ptype=<no-type> operator=PERCEQ CALL .<set-p> type=kotlin.Unit operator=PERCEQ
$value: CALL .mod type=kotlin.Int operator=PERCEQ <set-?>: CALL .mod type=kotlin.Int operator=PERCEQ
$this: GET_PROPERTY .p type=kotlin.Int operator=PERCEQ $this: CALL .<get-p> type=kotlin.Int operator=GET_PROPERTY
other: LITERAL Int type=kotlin.Int value='5' other: LITERAL Int type=kotlin.Int value='5'
+5 -5
View File
@@ -42,17 +42,17 @@ IrFile /augmentedAssignment2.kt
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: GET_PROPERTY .p type=A operator=PLUSEQ $receiver: CALL .<get-p> type=A operator=GET_PROPERTY
s: LITERAL String type=kotlin.String value='+=' s: LITERAL String type=kotlin.String value='+='
CALL .minusAssign type=kotlin.Unit operator=MINUSEQ CALL .minusAssign type=kotlin.Unit operator=MINUSEQ
$receiver: GET_PROPERTY .p type=A operator=MINUSEQ $receiver: CALL .<get-p> type=A operator=GET_PROPERTY
s: LITERAL String type=kotlin.String value='-=' s: LITERAL String type=kotlin.String value='-='
CALL .timesAssign type=kotlin.Unit operator=MULTEQ CALL .timesAssign type=kotlin.Unit operator=MULTEQ
$receiver: GET_PROPERTY .p type=A operator=MULTEQ $receiver: CALL .<get-p> type=A operator=GET_PROPERTY
s: LITERAL String type=kotlin.String value='*=' s: LITERAL String type=kotlin.String value='*='
CALL .divAssign type=kotlin.Unit operator=DIVEQ CALL .divAssign type=kotlin.Unit operator=DIVEQ
$receiver: GET_PROPERTY .p type=A operator=DIVEQ $receiver: CALL .<get-p> type=A operator=GET_PROPERTY
s: LITERAL String type=kotlin.String value='/=' s: LITERAL String type=kotlin.String value='/='
CALL .modAssign type=kotlin.Unit operator=PERCEQ CALL .modAssign type=kotlin.Unit operator=PERCEQ
$receiver: GET_PROPERTY .p type=A operator=PERCEQ $receiver: CALL .<get-p> type=A operator=GET_PROPERTY
s: LITERAL String type=kotlin.String value='%=' s: LITERAL String type=kotlin.String value='%='
+2 -2
View File
@@ -3,12 +3,12 @@ IrFile /dotQualified.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>
GET_PROPERTY .length type=kotlin.Int operator=null CALL .<get-length> type=kotlin.Int operator=GET_PROPERTY
$this: GET_VAR s type=kotlin.String operator=null $this: GET_VAR s type=kotlin.String operator=null
IrFunction public fun lengthN(/*0*/ s: kotlin.String?): kotlin.Int? IrFunction public fun lengthN(/*0*/ s: kotlin.String?): 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>
GET_PROPERTY ?.length type=kotlin.Int? operator=null CALL ?.<get-length> type=kotlin.Int? operator=GET_PROPERTY
$this: TYPE_OP operator=IMPLICIT_CAST typeOperand=kotlin.String $this: TYPE_OP operator=IMPLICIT_CAST typeOperand=kotlin.String
GET_VAR s type=kotlin.String? operator=null GET_VAR s type=kotlin.String? operator=null
@@ -9,5 +9,5 @@ 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>
GET_PROPERTY .okext type=kotlin.String operator=null CALL .<get-okext> type=kotlin.String operator=GET_PROPERTY
$receiver: $RECEIVER of: test5 type=kotlin.String $receiver: $RECEIVER of: test5 type=kotlin.String
+8 -8
View File
@@ -34,17 +34,17 @@ IrFile /incrementDecrement.kt
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
CALL .inc type=kotlin.Int operator=PREFIX_INCR CALL .inc type=kotlin.Int operator=PREFIX_INCR
$this: GET_PROPERTY .p type=kotlin.Int operator=PREFIX_INCR $this: CALL .<get-p> type=kotlin.Int operator=GET_PROPERTY
SET_PROPERTY .ptype=<no-type> operator=PREFIX_INCR CALL .<set-p> type=kotlin.Unit operator=PREFIX_INCR
$value: GET_VAR tmp0 type=kotlin.Int operator=null <set-?>: GET_VAR tmp0 type=kotlin.Int operator=null
GET_VAR tmp0 type=kotlin.Int operator=null GET_VAR tmp0 type=kotlin.Int operator=null
VAR val p2: kotlin.Int VAR val p2: kotlin.Int
BLOCK type=kotlin.Int hasResult=true operator=PREFIX_DECR BLOCK type=kotlin.Int hasResult=true operator=PREFIX_DECR
VAR val tmp1: kotlin.Int VAR val tmp1: kotlin.Int
CALL .dec type=kotlin.Int operator=PREFIX_DECR CALL .dec type=kotlin.Int operator=PREFIX_DECR
$this: GET_PROPERTY .p type=kotlin.Int operator=PREFIX_DECR $this: CALL .<get-p> type=kotlin.Int operator=GET_PROPERTY
SET_PROPERTY .ptype=<no-type> operator=PREFIX_DECR CALL .<set-p> type=kotlin.Unit operator=PREFIX_DECR
$value: 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 testArray(): kotlin.Unit
IrExpressionBody IrExpressionBody
@@ -52,7 +52,7 @@ IrFile /incrementDecrement.kt
VAR val a1: kotlin.Int VAR val a1: kotlin.Int
BLOCK type=kotlin.Int hasResult=true operator=PREFIX_INCR BLOCK type=kotlin.Int hasResult=true operator=PREFIX_INCR
VAR val tmp0_array: kotlin.IntArray VAR val tmp0_array: kotlin.IntArray
GET_PROPERTY .arr type=kotlin.IntArray operator=null CALL .<get-arr> type=kotlin.IntArray operator=GET_PROPERTY
VAR val tmp1: kotlin.Int VAR val tmp1: kotlin.Int
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
@@ -66,7 +66,7 @@ IrFile /incrementDecrement.kt
VAR val a2: kotlin.Int VAR val a2: kotlin.Int
BLOCK type=kotlin.Int hasResult=true operator=PREFIX_DECR BLOCK type=kotlin.Int hasResult=true operator=PREFIX_DECR
VAR val tmp2_array: kotlin.IntArray VAR val tmp2_array: kotlin.IntArray
GET_PROPERTY .arr type=kotlin.IntArray operator=null CALL .<get-arr> type=kotlin.IntArray operator=GET_PROPERTY
VAR val tmp3: kotlin.Int VAR val tmp3: kotlin.Int
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
+4 -4
View File
@@ -4,7 +4,7 @@ IrFile /references.kt
LITERAL String type=kotlin.String value='OK' LITERAL 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
GET_PROPERTY .ok type=kotlin.String operator=null CALL .<get-ok> type=kotlin.String operator=GET_PROPERTY
IrProperty public val ok3: kotlin.String getter=<get-ok3> setter=null IrProperty public val ok3: kotlin.String getter=<get-ok3> setter=null
IrPropertyGetter public fun <get-ok3>(): kotlin.String property=ok3 IrPropertyGetter public fun <get-ok3>(): kotlin.String property=ok3
IrExpressionBody IrExpressionBody
@@ -15,7 +15,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>
GET_PROPERTY .ok type=kotlin.String operator=null CALL .<get-ok> type=kotlin.String operator=GET_PROPERTY
IrFunction public fun test2(/*0*/ x: kotlin.String): kotlin.String IrFunction public fun test2(/*0*/ x: kotlin.String): kotlin.String
IrExpressionBody IrExpressionBody
BLOCK type=<no-type> hasResult=false operator=null BLOCK type=<no-type> hasResult=false operator=null
@@ -32,7 +32,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>
GET_PROPERTY .ok3 type=kotlin.String operator=null CALL .<get-ok3> type=kotlin.String operator=GET_PROPERTY
IrProperty public val kotlin.String.okext: kotlin.String getter=<get-okext> setter=null IrProperty public val kotlin.String.okext: kotlin.String getter=<get-okext> setter=null
IrPropertyGetter public fun kotlin.String.<get-okext>(): kotlin.String property=okext IrPropertyGetter public fun kotlin.String.<get-okext>(): kotlin.String property=okext
IrExpressionBody IrExpressionBody
@@ -43,5 +43,5 @@ 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>
GET_PROPERTY .okext type=kotlin.String operator=null CALL .<get-okext> type=kotlin.String operator=GET_PROPERTY
$receiver: $RECEIVER of: test5 type=kotlin.String $receiver: $RECEIVER of: test5 type=kotlin.String
+2 -2
View File
@@ -23,14 +23,14 @@ IrFile /smartCasts.kt
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>
CALL .println type=kotlin.Unit operator=null CALL .println type=kotlin.Unit operator=null
message: GET_PROPERTY .length type=kotlin.Int operator=null message: CALL .<get-length> type=kotlin.Int operator=GET_PROPERTY
$this: TYPE_OP operator=IMPLICIT_CAST typeOperand=kotlin.String $this: TYPE_OP operator=IMPLICIT_CAST typeOperand=kotlin.String
GET_VAR x type=kotlin.Any operator=null GET_VAR x type=kotlin.Any operator=null
CALL .expectsString type=kotlin.Unit operator=null CALL .expectsString type=kotlin.Unit operator=null
s: TYPE_OP operator=IMPLICIT_CAST typeOperand=kotlin.String s: TYPE_OP operator=IMPLICIT_CAST typeOperand=kotlin.String
GET_VAR x type=kotlin.Any operator=null GET_VAR x type=kotlin.Any operator=null
CALL .expectsInt type=kotlin.Unit operator=null CALL .expectsInt type=kotlin.Unit operator=null
i: GET_PROPERTY .length type=kotlin.Int operator=null i: CALL .<get-length> type=kotlin.Int operator=GET_PROPERTY
$this: TYPE_OP operator=IMPLICIT_CAST typeOperand=kotlin.String $this: TYPE_OP operator=IMPLICIT_CAST typeOperand=kotlin.String
GET_VAR x type=kotlin.Any operator=null GET_VAR x type=kotlin.Any operator=null
CALL .expectsString type=kotlin.Unit operator=null CALL .expectsString type=kotlin.Unit operator=null
+1 -1
View File
@@ -19,7 +19,7 @@ IrFile /values.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>
GET_PROPERTY .a type=kotlin.Int operator=null CALL .<get-a> type=kotlin.Int operator=GET_PROPERTY
IrFunction public fun test4(): Z.Companion IrFunction public fun test4(): Z.Companion
IrExpressionBody IrExpressionBody
BLOCK type=<no-type> hasResult=false operator=null BLOCK type=<no-type> hasResult=false operator=null