Represent class instance initialization "as from resolve".

This commit is contained in:
Dmitry Petrov
2016-09-01 18:32:07 +03:00
committed by Dmitry Petrov
parent c3c758c7cc
commit 1b5dd50359
43 changed files with 322 additions and 164 deletions
@@ -18,7 +18,6 @@ package org.jetbrains.kotlin.psi2ir.generators
import org.jetbrains.kotlin.builtins.KotlinBuiltIns
import org.jetbrains.kotlin.descriptors.*
import org.jetbrains.kotlin.ir.IrStatement
import org.jetbrains.kotlin.ir.declarations.IrFunctionBase
import org.jetbrains.kotlin.ir.descriptors.IrPropertyDelegateDescriptor
import org.jetbrains.kotlin.ir.expressions.*
@@ -32,7 +31,6 @@ import org.jetbrains.kotlin.psi2ir.builders.irReturn
import org.jetbrains.kotlin.psi2ir.intermediate.VariableLValue
import org.jetbrains.kotlin.psi2ir.intermediate.setExplicitReceiverValue
import org.jetbrains.kotlin.resolve.BindingContext
import java.lang.AssertionError
import java.util.*
class BodyGenerator(val scopeOwner: DeclarationDescriptor, override val context: GeneratorContext): GeneratorWithScope {
@@ -146,7 +144,9 @@ class BodyGenerator(val scopeOwner: DeclarationDescriptor, override val context:
generateSuperConstructorCall(irBlockBody, ktClassOrObject)
generateInitializersForPropertiesDefinedInPrimaryConstructor(irBlockBody, ktClassOrObject)
generateInitializersForClassBody(irBlockBody, ktClassOrObject)
val classDescriptor = (scopeOwner as ConstructorDescriptor).containingDeclaration
irBlockBody.addStatement(IrInstanceInitializerCallImpl(ktClassOrObject.startOffset, ktClassOrObject.endOffset, classDescriptor))
return irBlockBody
}
@@ -157,7 +157,7 @@ class BodyGenerator(val scopeOwner: DeclarationDescriptor, override val context:
generateDelegatingConstructorCall(irBlockBody, ktConstructor)
val classDescriptor = getOrFail(BindingContext.CONSTRUCTOR, ktConstructor).containingDeclaration
irBlockBody.addStatement(IrNestedInitializersCallImpl(ktConstructor.startOffset, ktConstructor.endOffset, classDescriptor))
irBlockBody.addStatement(IrInstanceInitializerCallImpl(ktConstructor.startOffset, ktConstructor.endOffset, classDescriptor))
ktConstructor.bodyExpression?.let { ktBody ->
createStatementGenerator().generateBlockBodyStatements(irBlockBody, ktBody)
@@ -197,6 +197,18 @@ class BodyGenerator(val scopeOwner: DeclarationDescriptor, override val context:
return generateEnumConstructorCallOrSuperCall(ktEnumEntry, enumEntryDescriptor.containingDeclaration as ClassDescriptor, null)
}
fun generateAnonymousInitializerBody(ktAnonymousInitializer: KtAnonymousInitializer): IrBlockBody {
val ktBody = ktAnonymousInitializer.body!!
val irBlockBody = IrBlockBodyImpl(ktBody.startOffset, ktBody.endOffset)
if (ktBody is KtBlockExpression) {
createStatementGenerator().generateBlockBodyStatements(irBlockBody, ktBody)
}
else {
irBlockBody.addStatement(createStatementGenerator().generateStatement(ktBody))
}
return irBlockBody
}
fun generateEnumEntryInitializer(ktEnumEntry: KtEnumEntry, enumEntryDescriptor: ClassDescriptor): IrExpression {
if (ktEnumEntry.declarations.isNotEmpty()) {
val enumEntryConstructor = enumEntryDescriptor.unsubstitutedPrimaryConstructor!!
@@ -229,41 +241,6 @@ class BodyGenerator(val scopeOwner: DeclarationDescriptor, override val context:
enumClassConstructor, enumEntryOrNull)
}
fun generateNestedInitializersBody(ktClassOrObject: KtClassOrObject): IrBody {
val irBody = IrBlockBodyImpl(ktClassOrObject.startOffset, ktClassOrObject.endOffset)
generateInitializersForClassBody(irBody, ktClassOrObject)
return irBody
}
private fun generateInitializersForClassBody(irBlockBody: IrBlockBodyImpl, ktClassOrObject: KtClassOrObject) {
ktClassOrObject.getBody()?.let { ktClassBody ->
for (ktDeclaration in ktClassBody.declarations) {
when (ktDeclaration) {
is KtProperty -> generateInitializerForPropertyDefinedInClassBody(irBlockBody, ktDeclaration)
is KtClassInitializer -> generateAnonymousInitializer(irBlockBody, ktDeclaration)
}
}
}
}
private fun generateAnonymousInitializer(irBlockBody: IrBlockBodyImpl, ktClassInitializer: KtClassInitializer) {
if (ktClassInitializer.body == null) return
val irInitializer = generateAnonymousInitializer(ktClassInitializer)
irBlockBody.addStatement(irInitializer)
}
fun generateAnonymousInitializer(ktInitializer: KtAnonymousInitializer): IrStatement {
return createStatementGenerator().generateStatement(ktInitializer.body!!)
}
private fun generateInitializerForPropertyDefinedInClassBody(irBlockBody: IrBlockBodyImpl, ktProperty: KtProperty) {
val propertyDescriptor = getOrFail(BindingContext.VARIABLE, ktProperty) as PropertyDescriptor
ktProperty.initializer?.let { ktInitializer ->
irBlockBody.addStatement(createPropertyInitializationExpression(
ktProperty, propertyDescriptor, createStatementGenerator().generateExpression(ktInitializer)))
}
}
private fun generateInitializersForPropertiesDefinedInPrimaryConstructor(irBlockBody: IrBlockBodyImpl, ktClassOrObject: KtClassOrObject) {
ktClassOrObject.getPrimaryConstructor()?.let { ktPrimaryConstructor ->
for (ktParameter in ktPrimaryConstructor.valueParameters) {
@@ -21,10 +21,11 @@ import org.jetbrains.kotlin.ir.declarations.*
import org.jetbrains.kotlin.ir.expressions.IrExpressionBodyImpl
import org.jetbrains.kotlin.ir.expressions.IrGetVariableImpl
import org.jetbrains.kotlin.ir.expressions.IrOperator
import org.jetbrains.kotlin.psi.*
import org.jetbrains.kotlin.psi.KtClassOrObject
import org.jetbrains.kotlin.psi.KtEnumEntry
import org.jetbrains.kotlin.psi.KtParameter
import org.jetbrains.kotlin.psi.psiUtil.endOffset
import org.jetbrains.kotlin.psi.psiUtil.startOffset
import org.jetbrains.kotlin.psi2ir.isConstructorDelegatingToSuper
import org.jetbrains.kotlin.resolve.BindingContext
class ClassGenerator(val declarationGenerator: DeclarationGenerator) : Generator {
@@ -40,10 +41,6 @@ class ClassGenerator(val declarationGenerator: DeclarationGenerator) : Generator
generateMembersDeclaredInClassBody(irClass, ktClassOrObject)
if (shouldGenerateNestedInitializers(ktClassOrObject)) {
irClass.nestedInitializers = BodyGenerator(descriptor, context).generateNestedInitializersBody(ktClassOrObject)
}
if (descriptor.isData) {
generateAdditionalMembersForDataClass(irClass, ktClassOrObject)
}
@@ -63,12 +60,6 @@ class ClassGenerator(val declarationGenerator: DeclarationGenerator) : Generator
EnumClassMembersGenerator(context).generateSpecialMembers(irClass)
}
private fun shouldGenerateNestedInitializers(ktClassOrObject: KtClassOrObject): Boolean {
val ktClassBody = ktClassOrObject.getBody() ?: return false
return ktClassBody.declarations.any { it is KtSecondaryConstructor && it.isConstructorDelegatingToSuper(context.bindingContext) }
}
private fun generatePrimaryConstructor(irClass: IrClassImpl, ktClassOrObject: KtClassOrObject) {
val primaryConstructorDescriptor = irClass.descriptor.unsubstitutedPrimaryConstructor ?: return
@@ -97,10 +88,7 @@ class ClassGenerator(val declarationGenerator: DeclarationGenerator) : Generator
private fun generateMembersDeclaredInClassBody(irClass: IrClassImpl, ktClassOrObject: KtClassOrObject) {
ktClassOrObject.getBody()?.let { ktClassBody ->
for (ktDeclaration in ktClassBody.declarations) {
if (ktDeclaration is KtAnonymousInitializer) continue
val irMember = declarationGenerator.generateMemberDeclaration(ktDeclaration)
val irMember = declarationGenerator.generateClassMemberDeclaration(ktDeclaration, irClass.descriptor)
irClass.addMember(irMember)
}
}
@@ -32,12 +32,8 @@ class DeclarationGenerator(override val context: GeneratorContext) : Generator {
when (ktDeclaration) {
is KtNamedFunction ->
generateFunctionDeclaration(ktDeclaration)
is KtSecondaryConstructor ->
generateSecondaryConstructor(ktDeclaration)
is KtProperty ->
generatePropertyDeclaration(ktDeclaration)
is KtEnumEntry ->
generateEnumEntryDeclaration(ktDeclaration)
is KtClassOrObject ->
generateClassOrObjectDeclaration(ktDeclaration)
is KtTypeAlias ->
@@ -49,6 +45,18 @@ class DeclarationGenerator(override val context: GeneratorContext) : Generator {
)
}
fun generateClassMemberDeclaration(ktDeclaration: KtDeclaration, classDescriptor: ClassDescriptor): IrDeclaration =
when (ktDeclaration) {
is KtAnonymousInitializer ->
generateAnonymousInitializerDeclaration(ktDeclaration, classDescriptor)
is KtSecondaryConstructor ->
generateSecondaryConstructor(ktDeclaration)
is KtEnumEntry ->
generateEnumEntryDeclaration(ktDeclaration)
else ->
generateMemberDeclaration(ktDeclaration)
}
private fun generateEnumEntryDeclaration(ktEnumEntry: KtEnumEntry): IrEnumEntry =
ClassGenerator(this).generateEnumEntry(ktEnumEntry)
@@ -59,6 +67,13 @@ class DeclarationGenerator(override val context: GeneratorContext) : Generator {
IrTypeAliasImpl(ktDeclaration.startOffset, ktDeclaration.endOffset, IrDeclarationOrigin.DEFINED,
getOrFail(BindingContext.TYPE_ALIAS, ktDeclaration))
fun generateAnonymousInitializerDeclaration(ktAnonymousInitializer: KtAnonymousInitializer, classDescriptor: ClassDescriptor): IrDeclaration {
val irAnonymousInitializer = IrAnonymousInitializerImpl(ktAnonymousInitializer.startOffset, ktAnonymousInitializer.endOffset,
IrDeclarationOrigin.DEFINED, classDescriptor)
irAnonymousInitializer.body = BodyGenerator(classDescriptor, context).generateAnonymousInitializerBody(ktAnonymousInitializer)
return irAnonymousInitializer
}
fun generateFunctionDeclaration(ktFunction: KtNamedFunction): IrGeneralFunction {
val functionDescriptor = getOrFail(BindingContext.FUNCTION, ktFunction)
val irFunction = IrFunctionImpl(ktFunction.startOffset, ktFunction.endOffset, IrDeclarationOrigin.DEFINED, functionDescriptor)
@@ -23,6 +23,7 @@ const val ARGUMENT1_SLOT = 1
const val DISPATCH_RECEIVER_SLOT = -1
const val EXTENSION_RECEIVER_SLOT = -2
const val FUNCTION_BODY_SLOT = -1
const val ANONYMOUS_INITIALIZER_BODY_SLOT = -1
const val MODULE_SLOT = 0
const val INITIALIZER_SLOT = 0
const val IF_CONDITION_SLOT = 0
@@ -0,0 +1,68 @@
/*
* 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.declarations
import org.jetbrains.kotlin.descriptors.ClassDescriptor
import org.jetbrains.kotlin.ir.*
import org.jetbrains.kotlin.ir.expressions.IrBlockBody
import org.jetbrains.kotlin.ir.visitors.IrElementVisitor
interface IrAnonymousInitializer : IrDeclaration {
override val descriptor: ClassDescriptor // TODO special descriptor for anonymous initializer blocks
override val declarationKind: IrDeclarationKind
get() = IrDeclarationKind.ANONYMOUS_INITIALIZER
var body: IrBlockBody
}
class IrAnonymousInitializerImpl(
startOffset: Int,
endOffset: Int,
origin: IrDeclarationOrigin,
override val descriptor: ClassDescriptor
) : IrDeclarationBase(startOffset, endOffset, origin), IrAnonymousInitializer {
private var bodyImpl: IrBlockBody? = null
override var body: IrBlockBody
get() = bodyImpl!!
set(value) {
value.assertDetached()
bodyImpl?.detach()
bodyImpl = value
value.setTreeLocation(this, ANONYMOUS_INITIALIZER_BODY_SLOT)
}
override fun getChild(slot: Int): IrElement? =
when (slot) {
ANONYMOUS_INITIALIZER_BODY_SLOT -> body
else -> null
}
override fun replaceChild(slot: Int, newChild: IrElement) {
when (slot) {
ANONYMOUS_INITIALIZER_BODY_SLOT -> body = newChild.assertCast()
}
}
override fun <R, D> accept(visitor: IrElementVisitor<R, D>, data: D): R {
return visitor.visitAnonymousInitializer(this, data)
}
override fun <D> acceptChildren(visitor: IrElementVisitor<Unit, D>, data: D) {
body.accept(visitor, data)
}
}
@@ -29,10 +29,23 @@ interface IrClass : IrDeclaration {
override val descriptor: ClassDescriptor
val members: List<IrDeclaration>
var nestedInitializers: IrBody?
}
fun IrClass.getInstanceInitializerMembers() =
members.filter {
when (it) {
is IrDelegate ->
true
is IrAnonymousInitializer ->
true
is IrSimpleProperty ->
it.valueInitializer != null
is IrDelegatedProperty ->
true
else -> false
}
}
class IrClassImpl(
startOffset: Int,
endOffset: Int,
@@ -47,41 +60,21 @@ class IrClassImpl(
members.add(member)
}
override var nestedInitializers: IrBody? = null
set(value) {
value?.assertDetached()
field?.detach()
field = value
value?.setTreeLocation(this, NESTED_INITIALIZERS_SLOT)
}
override fun getChild(slot: Int): IrElement? =
when (slot) {
NESTED_INITIALIZERS_SLOT -> nestedInitializers
else -> members.getOrNull(slot)
}
members.getOrNull(slot)
override fun replaceChild(slot: Int, newChild: IrElement) {
when (slot) {
NESTED_INITIALIZERS_SLOT ->
nestedInitializers = newChild.assertCast()
else -> {
newChild.assertDetached()
members.getOrNull(slot)?.detach() ?: throwNoSuchSlot(slot)
members[slot] = newChild.assertCast()
newChild.setTreeLocation(this, slot)
}
}
newChild.assertDetached()
members.getOrNull(slot)?.detach() ?: throwNoSuchSlot(slot)
members[slot] = newChild.assertCast()
newChild.setTreeLocation(this, slot)
}
override fun <R, D> accept(visitor: IrElementVisitor<R, D>, data: D): R =
visitor.visitClass(this, data)
override fun <D> acceptChildren(visitor: IrElementVisitor<Unit, D>, data: D) {
nestedInitializers?.accept(visitor, data)
members.forEach { it.accept(visitor, data) }
}
}
@@ -39,6 +39,7 @@ enum class IrDeclarationKind {
CLASS,
TYPEALIAS,
ENUM_ENTRY,
ANONYMOUS_INITIALIZER,
DUMMY;
}
@@ -20,16 +20,16 @@ import org.jetbrains.kotlin.descriptors.ClassDescriptor
import org.jetbrains.kotlin.ir.visitors.IrElementVisitor
import org.jetbrains.kotlin.resolve.descriptorUtil.builtIns
interface IrNestedInitializersCall : IrExpression {
interface IrInstanceInitializerCall : IrExpression {
val classDescriptor: ClassDescriptor
}
class IrNestedInitializersCallImpl(
class IrInstanceInitializerCallImpl(
startOffset: Int,
endOffset: Int,
override val classDescriptor: ClassDescriptor
) : IrTerminalExpressionBase(startOffset, endOffset, classDescriptor.builtIns.unitType), IrNestedInitializersCall {
) : IrTerminalExpressionBase(startOffset, endOffset, classDescriptor.builtIns.unitType), IrInstanceInitializerCall {
override fun <R, D> accept(visitor: IrElementVisitor<R, D>, data: D): R {
return visitor.visitNestedInitializersCall(this, data)
return visitor.visitInstanceInitializerCall(this, data)
}
}
@@ -60,15 +60,6 @@ class DumpIrTreeVisitor(out: Appendable): IrElementVisitor<Unit, String> {
}
}
override fun visitClass(declaration: IrClass, data: String) {
declaration.dumpLabeledElementWith(data) {
declaration.nestedInitializers?.accept(this, "nestedInitializers")
declaration.members.forEach {
it.accept(this, "")
}
}
}
override fun visitEnumEntry(declaration: IrEnumEntry, data: String) {
declaration.dumpLabeledElementWith(data) {
declaration.initializerExpression.accept(this, "init")
@@ -69,6 +69,9 @@ class RenderIrElementVisitor : IrElementVisitor<String, Nothing?> {
override fun visitEnumEntry(declaration: IrEnumEntry, data: Nothing?): String =
"ENUM_ENTRY ${declaration.descriptor.render()}"
override fun visitAnonymousInitializer(declaration: IrAnonymousInitializer, data: Nothing?): String =
"ANONYMOUS_INITIALIZER ${declaration.descriptor.name}"
override fun visitExpressionBody(body: IrExpressionBody, data: Nothing?): String =
"EXPRESSION_BODY"
@@ -119,8 +122,8 @@ class RenderIrElementVisitor : IrElementVisitor<String, Nothing?> {
else enumEntryDescriptor.name
}
override fun visitNestedInitializersCall(expression: IrNestedInitializersCall, data: Nothing?): String =
"NESTED_INITIALIZERS_CALL classDescriptor=${expression.classDescriptor.name}"
override fun visitInstanceInitializerCall(expression: IrInstanceInitializerCall, data: Nothing?): String =
"INSTANCE_INITIALIZER_CALL classDescriptor=${expression.classDescriptor.name}"
override fun visitGetVariable(expression: IrGetVariable, data: Nothing?): String =
"GET_VAR ${expression.descriptor.name} type=${expression.type.render()} operator=${expression.operator}"
@@ -39,6 +39,7 @@ interface IrElementVisitor<out R, in D> {
fun visitVariable(declaration: IrVariable, data: D) = visitDeclaration(declaration, data)
fun visitDelegate(declaration: IrDelegate, data: D) = visitDeclaration(declaration, data)
fun visitEnumEntry(declaration: IrEnumEntry, data: D) = visitDeclaration(declaration, data)
fun visitAnonymousInitializer(declaration: IrAnonymousInitializer, data: D) = visitDeclaration(declaration, data)
fun visitBody(body: IrBody, data: D) = visitElement(body, data)
fun visitExpressionBody(body: IrExpressionBody, data: D) = visitBody(body, data)
@@ -71,7 +72,7 @@ interface IrElementVisitor<out R, in D> {
fun visitCallableReference(expression: IrCallableReference, data: D) = visitDeclarationReference(expression, data)
fun visitClassReference(expression: IrClassReference, data: D) = visitDeclarationReference(expression, data)
fun visitNestedInitializersCall(expression: IrNestedInitializersCall, data: D) = visitExpression(expression, data)
fun visitInstanceInitializerCall(expression: IrInstanceInitializerCall, data: D) = visitExpression(expression, data)
fun visitTypeOperator(expression: IrTypeOperatorCall, data: D) = visitExpression(expression, data)
@@ -6,6 +6,7 @@ FILE /argumentReorderingInDelegatingConstructorCall.kt
GET_VAR x type=kotlin.Int operator=INITIALIZE_PROPERTY_FROM_PARAMETER
SET_BACKING_FIELD y type=kotlin.Unit operator=null
GET_VAR y type=kotlin.Int operator=INITIALIZE_PROPERTY_FROM_PARAMETER
INSTANCE_INITIALIZER_CALL classDescriptor=Base
PROPERTY public final val x: kotlin.Int
EXPRESSION_BODY
GET_VAR x type=kotlin.Int operator=INITIALIZE_PROPERTY_FROM_PARAMETER
@@ -23,8 +24,8 @@ FILE /argumentReorderingInDelegatingConstructorCall.kt
CALL .<init> type=Base operator=SUPER_CONSTRUCTOR_CALL
x: GET_VAR tmp1_x type=kotlin.Int operator=null
y: GET_VAR tmp0_y type=kotlin.Int operator=null
INSTANCE_INITIALIZER_CALL classDescriptor=Test1
CLASS CLASS Test2
nestedInitializers: BLOCK_BODY
CONSTRUCTOR public constructor Test2(/*0*/ xx: kotlin.Int, /*1*/ yy: kotlin.Int)
BLOCK_BODY
BLOCK type=Base operator=ARGUMENTS_REORDERING_FOR_CALL
@@ -36,7 +37,7 @@ FILE /argumentReorderingInDelegatingConstructorCall.kt
DELEGATING_CONSTRUCTOR_CALL Base
x: GET_VAR tmp1_x type=kotlin.Int operator=null
y: GET_VAR tmp0_y type=kotlin.Int operator=null
NESTED_INITIALIZERS_CALL classDescriptor=Test2
INSTANCE_INITIALIZER_CALL classDescriptor=Test2
CONSTRUCTOR public constructor Test2(/*0*/ xxx: kotlin.Int, /*1*/ yyy: kotlin.Int, /*2*/ a: kotlin.Any)
BLOCK_BODY
BLOCK type=Test2 operator=ARGUMENTS_REORDERING_FOR_CALL
+3 -2
View File
@@ -8,8 +8,7 @@ FILE /classMembers.kt
GET_VAR y type=kotlin.Int operator=INITIALIZE_PROPERTY_FROM_PARAMETER
SET_BACKING_FIELD z type=kotlin.Unit operator=null
GET_VAR z type=kotlin.Int operator=INITIALIZE_PROPERTY_FROM_PARAMETER
SET_BACKING_FIELD property type=kotlin.Unit operator=null
CONST Int type=kotlin.Int value='0'
INSTANCE_INITIALIZER_CALL classDescriptor=C
PROPERTY public final val y: kotlin.Int
EXPRESSION_BODY
GET_VAR y type=kotlin.Int operator=INITIALIZE_PROPERTY_FROM_PARAMETER
@@ -52,6 +51,7 @@ FILE /classMembers.kt
CLASS CLASS NestedClass
CONSTRUCTOR public constructor NestedClass()
BLOCK_BODY
INSTANCE_INITIALIZER_CALL classDescriptor=NestedClass
FUN public final fun function(): kotlin.Unit
BLOCK_BODY
CALL .println type=kotlin.Unit operator=null
@@ -70,3 +70,4 @@ FILE /classMembers.kt
CLASS OBJECT Companion
CONSTRUCTOR private constructor Companion()
BLOCK_BODY
INSTANCE_INITIALIZER_CALL classDescriptor=Companion
+4
View File
@@ -2,17 +2,21 @@ FILE /classes.kt
CLASS CLASS TestClass
CONSTRUCTOR public constructor TestClass()
BLOCK_BODY
INSTANCE_INITIALIZER_CALL classDescriptor=TestClass
CLASS INTERFACE TestInterface
CLASS OBJECT TestObject
CONSTRUCTOR private constructor TestObject()
BLOCK_BODY
INSTANCE_INITIALIZER_CALL classDescriptor=TestObject
CLASS ANNOTATION_CLASS TestAnnotationClass
CONSTRUCTOR public constructor TestAnnotationClass()
BLOCK_BODY
INSTANCE_INITIALIZER_CALL classDescriptor=TestAnnotationClass
CLASS ENUM_CLASS TestEnumClass
CONSTRUCTOR private constructor TestEnumClass()
BLOCK_BODY
ENUM_CONSTRUCTOR_CALL Enum super
INSTANCE_INITIALIZER_CALL classDescriptor=TestEnumClass
FUN public final /*synthesized*/ fun values(): kotlin.Array<TestEnumClass>
SYNTHETIC_BODY kind=ENUM_VALUES
FUN public final /*synthesized*/ fun valueOf(/*0*/ value: kotlin.String): TestEnumClass
@@ -2,12 +2,16 @@ FILE /companionObject.kt
CLASS CLASS Test1
CONSTRUCTOR public constructor Test1()
BLOCK_BODY
INSTANCE_INITIALIZER_CALL classDescriptor=Test1
CLASS OBJECT Companion
CONSTRUCTOR private constructor Companion()
BLOCK_BODY
INSTANCE_INITIALIZER_CALL classDescriptor=Companion
CLASS CLASS Test2
CONSTRUCTOR public constructor Test2()
BLOCK_BODY
INSTANCE_INITIALIZER_CALL classDescriptor=Test2
CLASS OBJECT Named
CONSTRUCTOR private constructor Named()
BLOCK_BODY
INSTANCE_INITIALIZER_CALL classDescriptor=Named
+1
View File
@@ -8,6 +8,7 @@ FILE /dataClasses.kt
GET_VAR y type=kotlin.String operator=INITIALIZE_PROPERTY_FROM_PARAMETER
SET_BACKING_FIELD z type=kotlin.Unit operator=null
GET_VAR z type=kotlin.Any operator=INITIALIZE_PROPERTY_FROM_PARAMETER
INSTANCE_INITIALIZER_CALL classDescriptor=Test1
PROPERTY public final val x: kotlin.Int
EXPRESSION_BODY
GET_VAR x type=kotlin.Int operator=INITIALIZE_PROPERTY_FROM_PARAMETER
@@ -2,16 +2,16 @@ FILE /delegatingConstructorCallsInSecondaryConstructors.kt
CLASS CLASS Base
CONSTRUCTOR public constructor Base()
BLOCK_BODY
INSTANCE_INITIALIZER_CALL classDescriptor=Base
CLASS CLASS Test
nestedInitializers: BLOCK_BODY
CONSTRUCTOR public constructor Test()
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL Base
NESTED_INITIALIZERS_CALL classDescriptor=Test
INSTANCE_INITIALIZER_CALL classDescriptor=Test
CONSTRUCTOR public constructor Test(/*0*/ xx: kotlin.Int)
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL Base
NESTED_INITIALIZERS_CALL classDescriptor=Test
INSTANCE_INITIALIZER_CALL classDescriptor=Test
CONSTRUCTOR public constructor Test(/*0*/ xx: kotlin.Short)
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL Test
+12 -4
View File
@@ -3,6 +3,7 @@ FILE /enum.kt
CONSTRUCTOR private constructor TestEnum1()
BLOCK_BODY
ENUM_CONSTRUCTOR_CALL Enum super
INSTANCE_INITIALIZER_CALL classDescriptor=TestEnum1
ENUM_ENTRY enum entry TEST1
init: ENUM_CONSTRUCTOR_CALL TestEnum1 TEST1
ENUM_ENTRY enum entry TEST2
@@ -17,6 +18,7 @@ FILE /enum.kt
ENUM_CONSTRUCTOR_CALL Enum super
SET_BACKING_FIELD x type=kotlin.Unit operator=null
GET_VAR x type=kotlin.Int operator=INITIALIZE_PROPERTY_FROM_PARAMETER
INSTANCE_INITIALIZER_CALL classDescriptor=TestEnum2
PROPERTY public final val x: kotlin.Int
EXPRESSION_BODY
GET_VAR x type=kotlin.Int operator=INITIALIZE_PROPERTY_FROM_PARAMETER
@@ -37,12 +39,14 @@ FILE /enum.kt
CONSTRUCTOR private constructor TestEnum3()
BLOCK_BODY
ENUM_CONSTRUCTOR_CALL Enum super
INSTANCE_INITIALIZER_CALL classDescriptor=TestEnum3
ENUM_ENTRY enum entry TEST
init: ENUM_CONSTRUCTOR_CALL TEST TEST
class: CLASS ENUM_ENTRY TEST
CONSTRUCTOR private constructor TEST()
BLOCK_BODY
ENUM_CONSTRUCTOR_CALL TestEnum3 super
INSTANCE_INITIALIZER_CALL classDescriptor=TEST
FUN public open override /*1*/ fun foo(): kotlin.Unit
BLOCK_BODY
CALL .println type=kotlin.Unit operator=null
@@ -58,6 +62,7 @@ FILE /enum.kt
ENUM_CONSTRUCTOR_CALL Enum super
SET_BACKING_FIELD x type=kotlin.Unit operator=null
GET_VAR x type=kotlin.Int operator=INITIALIZE_PROPERTY_FROM_PARAMETER
INSTANCE_INITIALIZER_CALL classDescriptor=TestEnum4
PROPERTY public final val x: kotlin.Int
EXPRESSION_BODY
GET_VAR x type=kotlin.Int operator=INITIALIZE_PROPERTY_FROM_PARAMETER
@@ -68,6 +73,7 @@ FILE /enum.kt
BLOCK_BODY
ENUM_CONSTRUCTOR_CALL TestEnum4 super
x: CONST Int type=kotlin.Int value='1'
INSTANCE_INITIALIZER_CALL classDescriptor=TEST1
FUN public open override /*1*/ fun foo(): kotlin.Unit
BLOCK_BODY
CALL .println type=kotlin.Unit operator=null
@@ -79,11 +85,13 @@ FILE /enum.kt
BLOCK_BODY
ENUM_CONSTRUCTOR_CALL TestEnum4 super
x: CONST Int type=kotlin.Int value='2'
BLOCK type=kotlin.Unit operator=null
SET_BACKING_FIELD z type=kotlin.Unit operator=null
CALL .<get-x> type=kotlin.Int operator=GET_PROPERTY
$this: THIS enum entry TEST2 type=TestEnum4.TEST2
INSTANCE_INITIALIZER_CALL classDescriptor=TEST2
PROPERTY public final val z: kotlin.Int
ANONYMOUS_INITIALIZER TEST2
BLOCK_BODY
SET_BACKING_FIELD z type=kotlin.Unit operator=null
CALL .<get-x> type=kotlin.Int operator=GET_PROPERTY
$this: THIS enum entry TEST2 type=TestEnum4.TEST2
FUN public open override /*1*/ fun foo(): kotlin.Unit
BLOCK_BODY
CALL .println type=kotlin.Unit operator=null
+31
View File
@@ -0,0 +1,31 @@
class Test1 {
init {
println()
}
}
class Test2(val x: Int) {
init {
println()
}
}
class Test3 {
init {
println()
}
constructor()
}
class Test4 {
init {
println("1")
}
constructor()
init {
println("2")
}
}
+41
View File
@@ -0,0 +1,41 @@
FILE /initBlock.kt
CLASS CLASS Test1
CONSTRUCTOR public constructor Test1()
BLOCK_BODY
INSTANCE_INITIALIZER_CALL classDescriptor=Test1
ANONYMOUS_INITIALIZER Test1
BLOCK_BODY
CALL .println type=kotlin.Unit operator=null
CLASS CLASS Test2
CONSTRUCTOR public constructor Test2(/*0*/ x: kotlin.Int)
BLOCK_BODY
SET_BACKING_FIELD x type=kotlin.Unit operator=null
GET_VAR x type=kotlin.Int operator=INITIALIZE_PROPERTY_FROM_PARAMETER
INSTANCE_INITIALIZER_CALL classDescriptor=Test2
PROPERTY public final val x: kotlin.Int
EXPRESSION_BODY
GET_VAR x type=kotlin.Int operator=INITIALIZE_PROPERTY_FROM_PARAMETER
ANONYMOUS_INITIALIZER Test2
BLOCK_BODY
CALL .println type=kotlin.Unit operator=null
CLASS CLASS Test3
ANONYMOUS_INITIALIZER Test3
BLOCK_BODY
CALL .println type=kotlin.Unit operator=null
CONSTRUCTOR public constructor Test3()
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL Any
INSTANCE_INITIALIZER_CALL classDescriptor=Test3
CLASS CLASS Test4
ANONYMOUS_INITIALIZER Test4
BLOCK_BODY
CALL .println type=kotlin.Unit operator=null
message: CONST String type=kotlin.String value='1'
CONSTRUCTOR public constructor Test4()
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL Any
INSTANCE_INITIALIZER_CALL classDescriptor=Test4
ANONYMOUS_INITIALIZER Test4
BLOCK_BODY
CALL .println type=kotlin.Unit operator=null
message: CONST String type=kotlin.String value='2'
+7 -5
View File
@@ -4,21 +4,23 @@ FILE /initVal.kt
BLOCK_BODY
SET_BACKING_FIELD x type=kotlin.Unit operator=null
GET_VAR x type=kotlin.Int operator=INITIALIZE_PROPERTY_FROM_PARAMETER
INSTANCE_INITIALIZER_CALL classDescriptor=TestInitValFromParameter
PROPERTY public final val x: kotlin.Int
EXPRESSION_BODY
GET_VAR x type=kotlin.Int operator=INITIALIZE_PROPERTY_FROM_PARAMETER
CLASS CLASS TestInitValInClass
CONSTRUCTOR public constructor TestInitValInClass()
BLOCK_BODY
SET_BACKING_FIELD x type=kotlin.Unit operator=null
CONST Int type=kotlin.Int value='0'
INSTANCE_INITIALIZER_CALL classDescriptor=TestInitValInClass
PROPERTY public final val x: kotlin.Int = 0
EXPRESSION_BODY
CONST Int type=kotlin.Int value='0'
CLASS CLASS TestInitValInInitBlock
CONSTRUCTOR public constructor TestInitValInInitBlock()
BLOCK_BODY
BLOCK type=kotlin.Unit operator=null
SET_BACKING_FIELD x type=kotlin.Unit operator=null
CONST Int type=kotlin.Int value='0'
INSTANCE_INITIALIZER_CALL classDescriptor=TestInitValInInitBlock
PROPERTY public final val x: kotlin.Int
ANONYMOUS_INITIALIZER TestInitValInInitBlock
BLOCK_BODY
SET_BACKING_FIELD x type=kotlin.Unit operator=null
CONST Int type=kotlin.Int value='0'
+16 -16
View File
@@ -4,30 +4,31 @@ FILE /initVar.kt
BLOCK_BODY
SET_BACKING_FIELD x type=kotlin.Unit operator=null
GET_VAR x type=kotlin.Int operator=INITIALIZE_PROPERTY_FROM_PARAMETER
INSTANCE_INITIALIZER_CALL classDescriptor=TestInitVarFromParameter
PROPERTY public final var x: kotlin.Int
EXPRESSION_BODY
GET_VAR x type=kotlin.Int operator=INITIALIZE_PROPERTY_FROM_PARAMETER
CLASS CLASS TestInitVarInClass
CONSTRUCTOR public constructor TestInitVarInClass()
BLOCK_BODY
SET_BACKING_FIELD x type=kotlin.Unit operator=null
CONST Int type=kotlin.Int value='0'
INSTANCE_INITIALIZER_CALL classDescriptor=TestInitVarInClass
PROPERTY public final var x: kotlin.Int
EXPRESSION_BODY
CONST Int type=kotlin.Int value='0'
CLASS CLASS TestInitVarInInitBlock
CONSTRUCTOR public constructor TestInitVarInInitBlock()
BLOCK_BODY
BLOCK type=kotlin.Unit operator=null
CALL .<set-x> type=kotlin.Unit operator=EQ
$this: THIS public final class TestInitVarInInitBlock type=TestInitVarInInitBlock
<set-?>: CONST Int type=kotlin.Int value='0'
INSTANCE_INITIALIZER_CALL classDescriptor=TestInitVarInInitBlock
PROPERTY public final var x: kotlin.Int
ANONYMOUS_INITIALIZER TestInitVarInInitBlock
BLOCK_BODY
CALL .<set-x> type=kotlin.Unit operator=EQ
$this: THIS public final class TestInitVarInInitBlock type=TestInitVarInInitBlock
<set-?>: CONST Int type=kotlin.Int value='0'
CLASS CLASS TestInitVarWithCustomSetter
CONSTRUCTOR public constructor TestInitVarWithCustomSetter()
BLOCK_BODY
SET_BACKING_FIELD x type=kotlin.Unit operator=null
CONST Int type=kotlin.Int value='0'
INSTANCE_INITIALIZER_CALL classDescriptor=TestInitVarWithCustomSetter
PROPERTY public final var x: kotlin.Int
EXPRESSION_BODY
CONST Int type=kotlin.Int value='0'
@@ -36,22 +37,21 @@ FILE /initVar.kt
SET_BACKING_FIELD x type=kotlin.Unit operator=EQ
GET_VAR value type=kotlin.Int operator=null
CLASS CLASS TestInitVarWithCustomSetterWithExplicitCtor
nestedInitializers: BLOCK_BODY
BLOCK type=kotlin.Unit operator=null
CALL .<set-x> type=kotlin.Unit operator=EQ
$this: THIS public final class TestInitVarWithCustomSetterWithExplicitCtor type=TestInitVarWithCustomSetterWithExplicitCtor
value: CONST Int type=kotlin.Int value='0'
PROPERTY public final var x: kotlin.Int
PROPERTY_SETTER public final fun <set-x>(/*0*/ value: kotlin.Int): kotlin.Unit
BLOCK_BODY
SET_BACKING_FIELD x type=kotlin.Unit operator=EQ
GET_VAR value type=kotlin.Int operator=null
ANONYMOUS_INITIALIZER TestInitVarWithCustomSetterWithExplicitCtor
BLOCK_BODY
CALL .<set-x> type=kotlin.Unit operator=EQ
$this: THIS public final class TestInitVarWithCustomSetterWithExplicitCtor type=TestInitVarWithCustomSetterWithExplicitCtor
value: CONST Int type=kotlin.Int value='0'
CONSTRUCTOR public constructor TestInitVarWithCustomSetterWithExplicitCtor()
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL Any
NESTED_INITIALIZERS_CALL classDescriptor=TestInitVarWithCustomSetterWithExplicitCtor
INSTANCE_INITIALIZER_CALL classDescriptor=TestInitVarWithCustomSetterWithExplicitCtor
CLASS CLASS TestInitVarWithCustomSetterInCtor
nestedInitializers: BLOCK_BODY
PROPERTY public final var x: kotlin.Int
PROPERTY_SETTER public final fun <set-x>(/*0*/ value: kotlin.Int): kotlin.Unit
BLOCK_BODY
@@ -60,7 +60,7 @@ FILE /initVar.kt
CONSTRUCTOR public constructor TestInitVarWithCustomSetterInCtor()
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL Any
NESTED_INITIALIZERS_CALL classDescriptor=TestInitVarWithCustomSetterInCtor
INSTANCE_INITIALIZER_CALL classDescriptor=TestInitVarWithCustomSetterInCtor
CALL .<set-x> type=kotlin.Unit operator=EQ
$this: THIS public final class TestInitVarWithCustomSetterInCtor type=TestInitVarWithCustomSetterInCtor
value: CONST Int type=kotlin.Int value='42'
+1
View File
@@ -4,6 +4,7 @@ FILE /localClasses.kt
CLASS CLASS LocalClass
CONSTRUCTOR public constructor LocalClass()
BLOCK_BODY
INSTANCE_INITIALIZER_CALL classDescriptor=LocalClass
FUN public final fun foo(): kotlin.Unit
BLOCK_BODY
CALL .foo type=kotlin.Unit operator=null
@@ -7,6 +7,7 @@ FILE /objectLiteralExpressions.kt
CLASS CLASS <no name provided>
CONSTRUCTOR public constructor <no name provided>()
BLOCK_BODY
INSTANCE_INITIALIZER_CALL classDescriptor=<no name provided>
CALL .<init> type=test1.<no name provided> operator=OBJECT_LITERAL
PROPERTY public val test2: IFoo
EXPRESSION_BODY
@@ -14,6 +15,7 @@ FILE /objectLiteralExpressions.kt
CLASS CLASS <no name provided>
CONSTRUCTOR public constructor <no name provided>()
BLOCK_BODY
INSTANCE_INITIALIZER_CALL classDescriptor=<no name provided>
FUN public open override /*1*/ fun foo(): kotlin.Unit
BLOCK_BODY
CALL .println type=kotlin.Unit operator=null
@@ -22,9 +24,11 @@ FILE /objectLiteralExpressions.kt
CLASS CLASS Outer
CONSTRUCTOR public constructor Outer()
BLOCK_BODY
INSTANCE_INITIALIZER_CALL classDescriptor=Outer
CLASS CLASS Inner
CONSTRUCTOR public constructor Inner()
BLOCK_BODY
INSTANCE_INITIALIZER_CALL classDescriptor=Inner
FUN public final fun test3(): Outer.Inner
BLOCK_BODY
RETURN type=kotlin.Nothing from=test3
@@ -34,6 +38,7 @@ FILE /objectLiteralExpressions.kt
BLOCK_BODY
CALL .<init> type=Outer.Inner operator=SUPER_CONSTRUCTOR_CALL
$this: THIS public final class Outer type=Outer
INSTANCE_INITIALIZER_CALL classDescriptor=<no name provided>
FUN public open override /*1*/ fun foo(): kotlin.Unit
BLOCK_BODY
CALL .println type=kotlin.Unit operator=null
@@ -48,6 +53,7 @@ FILE /objectLiteralExpressions.kt
BLOCK_BODY
CALL .<init> type=Outer.Inner operator=SUPER_CONSTRUCTOR_CALL
$this: $RECEIVER of: test4 type=Outer
INSTANCE_INITIALIZER_CALL classDescriptor=<no name provided>
FUN public open override /*1*/ fun foo(): kotlin.Unit
BLOCK_BODY
CALL .println type=kotlin.Unit operator=null
+7 -5
View File
@@ -6,6 +6,7 @@ FILE /primaryConstructor.kt
GET_VAR x type=kotlin.Int operator=INITIALIZE_PROPERTY_FROM_PARAMETER
SET_BACKING_FIELD y type=kotlin.Unit operator=null
GET_VAR y type=kotlin.Int operator=INITIALIZE_PROPERTY_FROM_PARAMETER
INSTANCE_INITIALIZER_CALL classDescriptor=Test1
PROPERTY public final val x: kotlin.Int
EXPRESSION_BODY
GET_VAR x type=kotlin.Int operator=INITIALIZE_PROPERTY_FROM_PARAMETER
@@ -17,8 +18,7 @@ FILE /primaryConstructor.kt
BLOCK_BODY
SET_BACKING_FIELD y type=kotlin.Unit operator=null
GET_VAR y type=kotlin.Int operator=INITIALIZE_PROPERTY_FROM_PARAMETER
SET_BACKING_FIELD x type=kotlin.Unit operator=null
GET_VAR x type=kotlin.Int operator=null
INSTANCE_INITIALIZER_CALL classDescriptor=Test2
PROPERTY public final val y: kotlin.Int
EXPRESSION_BODY
GET_VAR y type=kotlin.Int operator=INITIALIZE_PROPERTY_FROM_PARAMETER
@@ -30,10 +30,12 @@ FILE /primaryConstructor.kt
BLOCK_BODY
SET_BACKING_FIELD y type=kotlin.Unit operator=null
GET_VAR y type=kotlin.Int operator=INITIALIZE_PROPERTY_FROM_PARAMETER
BLOCK type=kotlin.Unit operator=null
SET_BACKING_FIELD x type=kotlin.Unit operator=null
GET_VAR x type=kotlin.Int operator=null
INSTANCE_INITIALIZER_CALL classDescriptor=Test3
PROPERTY public final val y: kotlin.Int
EXPRESSION_BODY
GET_VAR y type=kotlin.Int operator=INITIALIZE_PROPERTY_FROM_PARAMETER
PROPERTY public final val x: kotlin.Int
ANONYMOUS_INITIALIZER Test3
BLOCK_BODY
SET_BACKING_FIELD x type=kotlin.Unit operator=null
GET_VAR x type=kotlin.Int operator=null
@@ -2,14 +2,17 @@ FILE /primaryConstructorWithSuperConstructorCall.kt
CLASS CLASS Base
CONSTRUCTOR public constructor Base()
BLOCK_BODY
INSTANCE_INITIALIZER_CALL classDescriptor=Base
CLASS CLASS TestImplicitPrimaryConstructor
CONSTRUCTOR public constructor TestImplicitPrimaryConstructor()
BLOCK_BODY
CALL .<init> type=Base operator=SUPER_CONSTRUCTOR_CALL
INSTANCE_INITIALIZER_CALL classDescriptor=TestImplicitPrimaryConstructor
CLASS CLASS TestExplicitPrimaryConstructor
CONSTRUCTOR public constructor TestExplicitPrimaryConstructor()
BLOCK_BODY
CALL .<init> type=Base operator=SUPER_CONSTRUCTOR_CALL
INSTANCE_INITIALIZER_CALL classDescriptor=TestExplicitPrimaryConstructor
CLASS CLASS TestWithDelegatingConstructor
CONSTRUCTOR public constructor TestWithDelegatingConstructor(/*0*/ x: kotlin.Int, /*1*/ y: kotlin.Int)
BLOCK_BODY
@@ -18,6 +21,7 @@ FILE /primaryConstructorWithSuperConstructorCall.kt
GET_VAR x type=kotlin.Int operator=INITIALIZE_PROPERTY_FROM_PARAMETER
SET_BACKING_FIELD y type=kotlin.Unit operator=null
GET_VAR y type=kotlin.Int operator=INITIALIZE_PROPERTY_FROM_PARAMETER
INSTANCE_INITIALIZER_CALL classDescriptor=TestWithDelegatingConstructor
PROPERTY public final val x: kotlin.Int
EXPRESSION_BODY
GET_VAR x type=kotlin.Int operator=INITIALIZE_PROPERTY_FROM_PARAMETER
@@ -18,6 +18,7 @@ FILE /qualifiedSuperCalls.kt
CLASS CLASS CBoth
CONSTRUCTOR public constructor CBoth()
BLOCK_BODY
INSTANCE_INITIALIZER_CALL classDescriptor=CBoth
FUN public open override /*2*/ fun foo(): kotlin.Unit
BLOCK_BODY
CALL .foo superQualifier=ILeft type=kotlin.Unit operator=null
@@ -2,24 +2,22 @@ FILE /secondaryConstructorWithInitializersFromClassBody.kt
CLASS CLASS Base
CONSTRUCTOR public constructor Base()
BLOCK_BODY
INSTANCE_INITIALIZER_CALL classDescriptor=Base
CLASS CLASS TestProperty
nestedInitializers: BLOCK_BODY
SET_BACKING_FIELD x type=kotlin.Unit operator=null
CONST Int type=kotlin.Int value='0'
PROPERTY public final val x: kotlin.Int = 0
EXPRESSION_BODY
CONST Int type=kotlin.Int value='0'
CONSTRUCTOR public constructor TestProperty()
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL Base
NESTED_INITIALIZERS_CALL classDescriptor=TestProperty
INSTANCE_INITIALIZER_CALL classDescriptor=TestProperty
CLASS CLASS TestInitBlock
nestedInitializers: BLOCK_BODY
BLOCK type=kotlin.Unit operator=null
PROPERTY public final val x: kotlin.Int
ANONYMOUS_INITIALIZER TestInitBlock
BLOCK_BODY
SET_BACKING_FIELD x type=kotlin.Unit operator=null
CONST Int type=kotlin.Int value='0'
PROPERTY public final val x: kotlin.Int
CONSTRUCTOR public constructor TestInitBlock()
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL Base
NESTED_INITIALIZERS_CALL classDescriptor=TestInitBlock
INSTANCE_INITIALIZER_CALL classDescriptor=TestInitBlock
@@ -1,6 +1,5 @@
FILE /secondaryConstructors.kt
CLASS CLASS C
nestedInitializers: BLOCK_BODY
CONSTRUCTOR public constructor C()
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL C
@@ -8,4 +7,4 @@ FILE /secondaryConstructors.kt
CONSTRUCTOR public constructor C(/*0*/ x: kotlin.Int)
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL Any
NESTED_INITIALIZERS_CALL classDescriptor=C
INSTANCE_INITIALIZER_CALL classDescriptor=C
+2 -2
View File
@@ -2,8 +2,7 @@ FILE /superCalls.kt
CLASS CLASS Base
CONSTRUCTOR public constructor Base()
BLOCK_BODY
SET_BACKING_FIELD bar type=kotlin.Unit operator=null
CONST String type=kotlin.String value=''
INSTANCE_INITIALIZER_CALL classDescriptor=Base
FUN public open fun foo(): kotlin.Unit
BLOCK_BODY
PROPERTY public open val bar: kotlin.String = ""
@@ -13,6 +12,7 @@ FILE /superCalls.kt
CONSTRUCTOR public constructor Derived()
BLOCK_BODY
CALL .<init> type=Base operator=SUPER_CONSTRUCTOR_CALL
INSTANCE_INITIALIZER_CALL classDescriptor=Derived
FUN public open override /*1*/ fun foo(): kotlin.Unit
BLOCK_BODY
CALL .foo superQualifier=Base type=kotlin.Unit operator=null
@@ -21,6 +21,7 @@ FILE /delegatedProperties.kt
BLOCK_BODY
SET_BACKING_FIELD map type=kotlin.Unit operator=null
GET_VAR map type=kotlin.collections.MutableMap<kotlin.String, kotlin.Any> operator=INITIALIZE_PROPERTY_FROM_PARAMETER
INSTANCE_INITIALIZER_CALL classDescriptor=C
PROPERTY public final val map: kotlin.collections.MutableMap<kotlin.String, kotlin.Any>
EXPRESSION_BODY
GET_VAR map type=kotlin.collections.MutableMap<kotlin.String, kotlin.Any> operator=INITIALIZE_PROPERTY_FROM_PARAMETER
@@ -16,6 +16,7 @@ FILE /arrayAugmentedAssignment1.kt
BLOCK_BODY
SET_BACKING_FIELD x type=kotlin.Unit operator=null
GET_VAR x type=kotlin.IntArray operator=INITIALIZE_PROPERTY_FROM_PARAMETER
INSTANCE_INITIALIZER_CALL classDescriptor=C
PROPERTY public final val x: kotlin.IntArray
EXPRESSION_BODY
GET_VAR x type=kotlin.IntArray operator=INITIALIZE_PROPERTY_FROM_PARAMETER
@@ -4,6 +4,7 @@ FILE /assignments.kt
BLOCK_BODY
SET_BACKING_FIELD x type=kotlin.Unit operator=null
GET_VAR x type=kotlin.Int operator=INITIALIZE_PROPERTY_FROM_PARAMETER
INSTANCE_INITIALIZER_CALL classDescriptor=Ref
PROPERTY public final var x: kotlin.Int
EXPRESSION_BODY
GET_VAR x type=kotlin.Int operator=INITIALIZE_PROPERTY_FROM_PARAMETER
@@ -2,6 +2,7 @@ FILE /augmentedAssignment2.kt
CLASS CLASS A
CONSTRUCTOR public constructor A()
BLOCK_BODY
INSTANCE_INITIALIZER_CALL classDescriptor=A
FUN public operator fun A.plusAssign(/*0*/ s: kotlin.String): kotlin.Unit
BLOCK_BODY
FUN public operator fun A.minusAssign(/*0*/ s: kotlin.String): kotlin.Unit
@@ -2,6 +2,7 @@ FILE /chainOfSafeCalls.kt
CLASS CLASS C
CONSTRUCTOR public constructor C()
BLOCK_BODY
INSTANCE_INITIALIZER_CALL classDescriptor=C
FUN public final fun foo(): C
BLOCK_BODY
RETURN type=kotlin.Nothing from=foo
@@ -2,11 +2,13 @@ FILE /forWithImplicitReceivers.kt
CLASS OBJECT FiveTimes
CONSTRUCTOR private constructor FiveTimes()
BLOCK_BODY
INSTANCE_INITIALIZER_CALL classDescriptor=FiveTimes
CLASS CLASS IntCell
CONSTRUCTOR public constructor IntCell(/*0*/ value: kotlin.Int)
BLOCK_BODY
SET_BACKING_FIELD value type=kotlin.Unit operator=null
GET_VAR value type=kotlin.Int operator=INITIALIZE_PROPERTY_FROM_PARAMETER
INSTANCE_INITIALIZER_CALL classDescriptor=IntCell
PROPERTY public final var value: kotlin.Int
EXPRESSION_BODY
GET_VAR value type=kotlin.Int operator=INITIALIZE_PROPERTY_FROM_PARAMETER
@@ -23,19 +23,7 @@ FILE /jvmStaticFieldReference.kt
CLASS CLASS TestClass
CONSTRUCTOR public constructor TestClass()
BLOCK_BODY
SET_BACKING_FIELD test type=kotlin.Unit operator=null
WHEN type=kotlin.Int operator=WHEN
else: BLOCK type=kotlin.Int operator=null
CALL .println type=kotlin.Unit operator=null
$this: TYPE_OP operator=IMPLICIT_NOTNULL typeOperand=java.io.PrintStream
CALL .<get-out> type=java.io.PrintStream! operator=GET_PROPERTY
p0: CONST String type=kotlin.String value='TestClass/test'
CONST Int type=kotlin.Int value='42'
BLOCK type=kotlin.Unit operator=null
CALL .println type=kotlin.Unit operator=null
$this: TYPE_OP operator=IMPLICIT_NOTNULL typeOperand=java.io.PrintStream
CALL .<get-out> type=java.io.PrintStream! operator=GET_PROPERTY
p0: CONST String type=kotlin.String value='TestClass/init'
INSTANCE_INITIALIZER_CALL classDescriptor=TestClass
PROPERTY public final val test: kotlin.Int
EXPRESSION_BODY
WHEN type=kotlin.Int operator=WHEN
@@ -45,3 +33,9 @@ FILE /jvmStaticFieldReference.kt
CALL .<get-out> type=java.io.PrintStream! operator=GET_PROPERTY
p0: CONST String type=kotlin.String value='TestClass/test'
CONST Int type=kotlin.Int value='42'
ANONYMOUS_INITIALIZER TestClass
BLOCK_BODY
CALL .println type=kotlin.Unit operator=null
$this: TYPE_OP operator=IMPLICIT_NOTNULL typeOperand=java.io.PrintStream
CALL .<get-out> type=java.io.PrintStream! operator=GET_PROPERTY
p0: CONST String type=kotlin.String value='TestClass/init'
@@ -2,6 +2,7 @@ FILE /safeCallWithIncrementDecrement.kt
CLASS CLASS C
CONSTRUCTOR public constructor C()
BLOCK_BODY
INSTANCE_INITIALIZER_CALL classDescriptor=C
PROPERTY public var test.C?.p: kotlin.Int
PROPERTY_GETTER public fun test.C?.<get-p>(): kotlin.Int
BLOCK_BODY
+1
View File
@@ -4,6 +4,7 @@ FILE /safeCalls.kt
BLOCK_BODY
SET_BACKING_FIELD value type=kotlin.Unit operator=null
GET_VAR value type=kotlin.Int operator=INITIALIZE_PROPERTY_FROM_PARAMETER
INSTANCE_INITIALIZER_CALL classDescriptor=Ref
PROPERTY public final var value: kotlin.Int
EXPRESSION_BODY
GET_VAR value type=kotlin.Int operator=INITIALIZE_PROPERTY_FROM_PARAMETER
+4
View File
@@ -3,6 +3,7 @@ FILE /values.kt
CONSTRUCTOR private constructor Enum()
BLOCK_BODY
ENUM_CONSTRUCTOR_CALL Enum super
INSTANCE_INITIALIZER_CALL classDescriptor=Enum
ENUM_ENTRY enum entry A
init: ENUM_CONSTRUCTOR_CALL Enum A
FUN public final /*synthesized*/ fun values(): kotlin.Array<Enum>
@@ -12,15 +13,18 @@ FILE /values.kt
CLASS OBJECT A
CONSTRUCTOR private constructor A()
BLOCK_BODY
INSTANCE_INITIALIZER_CALL classDescriptor=A
PROPERTY public val a: kotlin.Int = 0
EXPRESSION_BODY
CONST Int type=kotlin.Int value='0'
CLASS CLASS Z
CONSTRUCTOR public constructor Z()
BLOCK_BODY
INSTANCE_INITIALIZER_CALL classDescriptor=Z
CLASS OBJECT Companion
CONSTRUCTOR private constructor Companion()
BLOCK_BODY
INSTANCE_INITIALIZER_CALL classDescriptor=Companion
FUN public fun test1(): Enum
BLOCK_BODY
RETURN type=kotlin.Nothing from=test1
+1
View File
@@ -2,6 +2,7 @@ FILE /when.kt
CLASS OBJECT A
CONSTRUCTOR private constructor A()
BLOCK_BODY
INSTANCE_INITIALIZER_CALL classDescriptor=A
FUN public fun testWithSubject(/*0*/ x: kotlin.Any?): kotlin.String
BLOCK_BODY
RETURN type=kotlin.Nothing from=testWithSubject
@@ -2,9 +2,11 @@ FILE /multipleImplicitReceivers.kt
CLASS OBJECT A
CONSTRUCTOR private constructor A()
BLOCK_BODY
INSTANCE_INITIALIZER_CALL classDescriptor=A
CLASS OBJECT B
CONSTRUCTOR private constructor B()
BLOCK_BODY
INSTANCE_INITIALIZER_CALL classDescriptor=B
CLASS INTERFACE IFoo
PROPERTY public open val A.foo: B
PROPERTY_GETTER public open fun A.<get-foo>(): B
@@ -85,6 +85,12 @@ public class IrTextTestCaseGenerated extends AbstractIrTextTestCase {
doTest(fileName);
}
@TestMetadata("initBlock.kt")
public void testInitBlock() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/ir/irText/classes/initBlock.kt");
doTest(fileName);
}
@TestMetadata("initVal.kt")
public void testInitVal() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/ir/irText/classes/initVal.kt");