When expression.

Fix object & enum references.
This commit is contained in:
Dmitry Petrov
2016-08-19 13:21:56 +03:00
committed by Dmitry Petrov
parent d6040d8570
commit b96626fd4c
14 changed files with 301 additions and 74 deletions
+1 -1
View File
@@ -3,7 +3,7 @@ IrFunction public fun B.test(): kotlin.Unit
BLOCK type=<no-type> hasResult=false operator=null
BLOCK type=<no-type> hasResult=false operator=SYNTHETIC_BLOCK
VAR val tmp0: A
GET_VAR A type=A operator=null
GET_OBJECT A type=A
VAR val x: kotlin.Int
CALL .component1 type=kotlin.Int operator=COMPONENT_N(index=1)
$this: $RECEIVER of: test type=B
+11
View File
@@ -0,0 +1,11 @@
enum class Enum { A }
object A
val a = 0
class Z {
companion object
}
fun test1() = Enum.A
fun test2() = A
fun test3() = a
fun test4() = Z
+27
View File
@@ -0,0 +1,27 @@
IrFile /values.kt
DUMMY Enum
DUMMY A
IrProperty public val a: kotlin.Int = 0 getter=null setter=null
IrExpressionBody
LITERAL Int type=kotlin.Int value='0'
DUMMY Z
IrFunction public fun test1(): Enum
IrExpressionBody
BLOCK type=<no-type> hasResult=false operator=null
RETURN type=<no-type>
GET_ENUM_VALUE A type=Enum
IrFunction public fun test2(): A
IrExpressionBody
BLOCK type=<no-type> hasResult=false operator=null
RETURN type=<no-type>
GET_OBJECT A type=A
IrFunction public fun test3(): kotlin.Int
IrExpressionBody
BLOCK type=<no-type> hasResult=false operator=null
RETURN type=<no-type>
GET_PROPERTY .a type=kotlin.Int operator=null
IrFunction public fun test4(): Z.Companion
IrExpressionBody
BLOCK type=<no-type> hasResult=false operator=null
RETURN type=<no-type>
GET_OBJECT Companion type=Z.Companion
+10
View File
@@ -0,0 +1,10 @@
object A
fun test(x: Any?) =
when (x) {
null -> "null"
A -> "A"
is String -> "String"
in setOf<Nothing>() -> "nothingness?"
else -> "something"
}
+26
View File
@@ -0,0 +1,26 @@
IrFile /when.kt
DUMMY A
IrFunction public fun test(/*0*/ x: kotlin.Any?): kotlin.String
IrExpressionBody
BLOCK type=<no-type> hasResult=false operator=null
RETURN type=<no-type>
WHEN subject=tmp0_subject type=kotlin.String
$subject:: VAR val tmp0_subject: kotlin.Any?
GET_VAR x type=kotlin.Any? operator=null
if: BINARY_OP operator=EQEQ type=kotlin.Boolean related=null
GET_VAR tmp0_subject type=kotlin.Any? operator=null
LITERAL Null type=kotlin.Nothing? value='null'
then: LITERAL String type=kotlin.String value='null'
if: BINARY_OP operator=EQEQ type=kotlin.Boolean related=null
GET_VAR tmp0_subject type=kotlin.Any? operator=null
GET_OBJECT A type=A
then: LITERAL String type=kotlin.String value='A'
if: TYPE_OP operator=INSTANCEOF typeOperand=kotlin.String
GET_VAR tmp0_subject type=kotlin.Any? operator=null
then: LITERAL String type=kotlin.String value='String'
if: CALL .contains type=kotlin.Boolean operator=IN
$receiver: CALL .setOf type=kotlin.collections.Set<kotlin.Nothing> operator=null
element: TYPE_OP operator=IMPLICIT_CAST typeOperand=kotlin.Any
GET_VAR tmp0_subject type=kotlin.Any? operator=null
then: LITERAL String type=kotlin.String value='nothingness?'
else: LITERAL String type=kotlin.String value='something'