- IR expressions for calls & references

- first calls "parsed"
This commit is contained in:
Dmitry Petrov
2016-08-10 19:41:07 +03:00
committed by Dmitry Petrov
parent c09ba962c4
commit c93666f6f1
24 changed files with 768 additions and 64 deletions
+2 -2
View File
@@ -1,5 +1,5 @@
IrFile /boxOk.kt
IrFunction public fun box(): kotlin.String
IrExpressionBody
IrReturnExpression type=kotlin.String
IrLiteral String type=kotlin.String value='OK'
RETURN type=kotlin.String
LITERAL String type=kotlin.String value='OK'
+8
View File
@@ -0,0 +1,8 @@
fun foo(x: Int, y: Int) = x
fun bar(x: Int) = foo(x, 1)
fun qux(x: Int) = foo(foo(x, x), x)
fun Int.ext1() = this
fun Int.ext2(x: Int) = foo(this, x)
// IR_FILE_TXT calls.txt
+29
View File
@@ -0,0 +1,29 @@
IrFile /calls.kt
IrFunction public fun foo(/*0*/ x: kotlin.Int, /*1*/ y: kotlin.Int): kotlin.Int
IrExpressionBody
RETURN type=kotlin.Int
VAR x
IrFunction public fun bar(/*0*/ x: kotlin.Int): kotlin.Int
IrExpressionBody
RETURN type=kotlin.Int
CALL foo
x: VAR x
y: LITERAL Int type=kotlin.Int value='1'
IrFunction public fun qux(/*0*/ x: kotlin.Int): kotlin.Int
IrExpressionBody
RETURN type=kotlin.Int
CALL foo
x: CALL foo
x: VAR x
y: VAR x
y: VAR x
IrFunction public fun kotlin.Int.ext1(): kotlin.Int
IrExpressionBody
RETURN type=kotlin.Int
DUMMY KtThisExpression
IrFunction public fun kotlin.Int.ext2(/*0*/ x: kotlin.Int): kotlin.Int
IrExpressionBody
RETURN type=kotlin.Int
CALL foo
x: DUMMY KtThisExpression
y: VAR x
@@ -0,0 +1,4 @@
val String.okext: String get() = "OK"
fun String.test5() = okext
// IR_FILE_TXT extensionPropertyGetterCall.txt
@@ -0,0 +1,11 @@
IrFile /extensionPropertyGetterCall.kt
IrProperty public val kotlin.String.okext: kotlin.String getter=<get-okext> setter=null
IrPropertyGetter public fun kotlin.String.<get-okext>(): kotlin.String property=okext
IrExpressionBody
RETURN type=kotlin.String
LITERAL String type=kotlin.String value='OK'
IrFunction public fun kotlin.String.test5(): kotlin.String
IrExpressionBody
RETURN type=kotlin.String
CALL okext PROPERTY_GET
$receiver: $RECEIVER of: test5
+19
View File
@@ -0,0 +1,19 @@
val ok = "OK"
val ok2 = ok
val ok3: String get() = "OK"
fun test1() = ok
fun test2(x: String) = x
fun test3(): String {
val x = "OK"
return x
}
fun test4() = ok3
val String.okext: String get() = "OK"
fun String.test5() = okext
// IR_FILE_TXT references.txt
+42
View File
@@ -0,0 +1,42 @@
IrFile /references.kt
IrProperty public val ok: kotlin.String = "OK" getter=null setter=null
IrExpressionBody
RETURN type=kotlin.String
LITERAL String type=kotlin.String value='OK'
IrProperty public val ok2: kotlin.String = "OK" getter=null setter=null
IrExpressionBody
RETURN type=kotlin.String
CALL ok PROPERTY_GET
IrProperty public val ok3: kotlin.String getter=<get-ok3> setter=null
IrPropertyGetter public fun <get-ok3>(): kotlin.String property=ok3
IrExpressionBody
RETURN type=kotlin.String
LITERAL String type=kotlin.String value='OK'
IrFunction public fun test1(): kotlin.String
IrExpressionBody
RETURN type=kotlin.String
CALL ok PROPERTY_GET
IrFunction public fun test2(/*0*/ x: kotlin.String): kotlin.String
IrExpressionBody
RETURN type=kotlin.String
VAR x
IrFunction public fun test3(): kotlin.String
IrExpressionBody
BLOCK type=kotlin.Nothing
DUMMY KtProperty
RETURN type=kotlin.Nothing
VAR x
IrFunction public fun test4(): kotlin.String
IrExpressionBody
RETURN type=kotlin.String
CALL ok3 PROPERTY_GET
IrProperty public val kotlin.String.okext: kotlin.String getter=<get-okext> setter=null
IrPropertyGetter public fun kotlin.String.<get-okext>(): kotlin.String property=okext
IrExpressionBody
RETURN type=kotlin.String
LITERAL String type=kotlin.String value='OK'
IrFunction public fun kotlin.String.test5(): kotlin.String
IrExpressionBody
RETURN type=kotlin.String
CALL okext PROPERTY_GET
$receiver: $RECEIVER of: test5
+12 -12
View File
@@ -1,27 +1,27 @@
IrFile /smoke.kt
IrFunction public fun testFun(): kotlin.String
IrExpressionBody
IrBlockExpression type=kotlin.Nothing
IrReturnExpression type=kotlin.Nothing
IrLiteral String type=kotlin.String value='OK'
BLOCK type=kotlin.Nothing
RETURN type=kotlin.Nothing
LITERAL String type=kotlin.String value='OK'
IrProperty public val testSimpleVal: kotlin.Int = 1 getter=null setter=null
IrExpressionBody
IrReturnExpression type=kotlin.Int
IrLiteral Int type=kotlin.Int value='1'
RETURN type=kotlin.Int
LITERAL Int type=kotlin.Int value='1'
IrProperty public val testValWithGetter: kotlin.Int getter=<get-testValWithGetter> setter=null
IrPropertyGetter public fun <get-testValWithGetter>(): kotlin.Int property=testValWithGetter
IrExpressionBody
IrReturnExpression type=kotlin.Int
IrLiteral Int type=kotlin.Int value='42'
RETURN type=kotlin.Int
LITERAL Int type=kotlin.Int value='42'
IrProperty public var testSimpleVar: kotlin.Int getter=null setter=null
IrExpressionBody
IrReturnExpression type=kotlin.Int
IrLiteral Int type=kotlin.Int value='2'
RETURN type=kotlin.Int
LITERAL Int type=kotlin.Int value='2'
IrProperty public var testVarWithAccessors: kotlin.Int getter=<get-testVarWithAccessors> setter=<set-testVarWithAccessors>
IrPropertyGetter public fun <get-testVarWithAccessors>(): kotlin.Int property=testVarWithAccessors
IrExpressionBody
IrReturnExpression type=kotlin.Int
IrLiteral Int type=kotlin.Int value='42'
RETURN type=kotlin.Int
LITERAL Int type=kotlin.Int value='42'
IrPropertySetter public fun <set-testVarWithAccessors>(/*0*/ v: kotlin.Int): kotlin.Unit property=testVarWithAccessors
IrExpressionBody
IrBlockExpression type=kotlin.Unit
BLOCK type=kotlin.Unit