IrBody is no longer a declaration owner.

Local declarations in expression tree.
Call generator supports argument reordering.
This commit is contained in:
Dmitry Petrov
2016-08-12 19:08:42 +03:00
committed by Dmitry Petrov
parent b1af1af8a4
commit 030111b130
36 changed files with 631 additions and 269 deletions
+1 -2
View File
@@ -1,5 +1,4 @@
IrFile /boxOk.kt
IrFunction public fun box(): kotlin.String
IrExpressionBody
RETURN type=kotlin.String
LITERAL String type=kotlin.String value='OK'
LITERAL String type=kotlin.String value='OK'
@@ -0,0 +1,13 @@
// <<< callWithReorderedArguments.txt
fun foo(a: Int, b: Int) {}
fun noReorder1() = 1
fun noReorder2() = 2
fun reordered1() = 1
fun reordered2() = 2
fun test() {
foo(a = noReorder1(), b = noReorder2())
foo(b = reordered1(), a = reordered2())
}
@@ -0,0 +1,32 @@
IrFile /callWithReorderedArguments.kt
IrFunction public fun foo(/*0*/ a: kotlin.Int, /*1*/ b: kotlin.Int): kotlin.Unit
IrExpressionBody
BLOCK type=kotlin.Unit
IrFunction public fun noReorder1(): kotlin.Int
IrExpressionBody
LITERAL Int type=kotlin.Int value='1'
IrFunction public fun noReorder2(): kotlin.Int
IrExpressionBody
LITERAL Int type=kotlin.Int value='2'
IrFunction public fun reordered1(): kotlin.Int
IrExpressionBody
LITERAL Int type=kotlin.Int value='1'
IrFunction public fun reordered2(): kotlin.Int
IrExpressionBody
LITERAL Int type=kotlin.Int value='2'
IrFunction public fun test(): kotlin.Unit
IrExpressionBody
BLOCK type=kotlin.Unit
CALL .foo
a: CALL .noReorder1
b: CALL .noReorder2
BLOCK type=kotlin.Unit
LOCAL tmp0
IrLocalVariable val tmp0: kotlin.Int
CALL .reordered1
LOCAL tmp1
IrLocalVariable val tmp1: kotlin.Int
CALL .reordered2
CALL .foo
a: GET_VAR tmp1
b: GET_VAR tmp0
+12 -17
View File
@@ -1,29 +1,24 @@
IrFile /calls.kt
IrFunction public fun foo(/*0*/ x: kotlin.Int, /*1*/ y: kotlin.Int): kotlin.Int
IrExpressionBody
RETURN type=kotlin.Int
GET_VAR x
GET_VAR x
IrFunction public fun bar(/*0*/ x: kotlin.Int): kotlin.Int
IrExpressionBody
RETURN type=kotlin.Int
CALL .foo
x: GET_VAR x
y: LITERAL Int type=kotlin.Int value='1'
CALL .foo
x: GET_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: GET_VAR x
y: GET_VAR x
CALL .foo
x: CALL .foo
x: GET_VAR x
y: GET_VAR x
y: GET_VAR x
IrFunction public fun kotlin.Int.ext1(): kotlin.Int
IrExpressionBody
RETURN type=kotlin.Int
$RECEIVER of: ext1
$RECEIVER of: ext1
IrFunction public fun kotlin.Int.ext2(/*0*/ x: kotlin.Int): kotlin.Int
IrExpressionBody
RETURN type=kotlin.Int
CALL .foo
x: $RECEIVER of: ext2
y: GET_VAR x
CALL .foo
x: $RECEIVER of: ext2
y: GET_VAR x
+4 -6
View File
@@ -1,11 +1,9 @@
IrFile /dotQualified.kt
IrFunction public fun length(/*0*/ s: kotlin.String): kotlin.Int
IrExpressionBody
RETURN type=kotlin.Int
GET_PROPERTY .length
$this: GET_VAR s
GET_PROPERTY .length
$this: GET_VAR s
IrFunction public fun lengthN(/*0*/ s: kotlin.String?): kotlin.Int?
IrExpressionBody
RETURN type=kotlin.Int?
GET_PROPERTY ?.length
$this: GET_VAR s
GET_PROPERTY ?.length
$this: GET_VAR s
@@ -2,10 +2,8 @@ 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'
LITERAL String type=kotlin.String value='OK'
IrFunction public fun kotlin.String.test5(): kotlin.String
IrExpressionBody
RETURN type=kotlin.String
GET_PROPERTY .okext
$receiver: $RECEIVER of: test5
GET_PROPERTY .okext
$receiver: $RECEIVER of: test5
+9 -17
View File
@@ -1,25 +1,20 @@
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'
LITERAL String type=kotlin.String value='OK'
IrProperty public val ok2: kotlin.String = "OK" getter=null setter=null
IrExpressionBody
RETURN type=kotlin.String
GET_PROPERTY .ok
GET_PROPERTY .ok
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'
LITERAL String type=kotlin.String value='OK'
IrFunction public fun test1(): kotlin.String
IrExpressionBody
RETURN type=kotlin.String
GET_PROPERTY .ok
GET_PROPERTY .ok
IrFunction public fun test2(/*0*/ x: kotlin.String): kotlin.String
IrExpressionBody
RETURN type=kotlin.String
GET_VAR x
GET_VAR x
IrFunction public fun test3(): kotlin.String
IrExpressionBody
BLOCK type=kotlin.Nothing
@@ -28,15 +23,12 @@ IrFile /references.kt
GET_VAR x
IrFunction public fun test4(): kotlin.String
IrExpressionBody
RETURN type=kotlin.String
GET_PROPERTY .ok3
GET_PROPERTY .ok3
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'
LITERAL String type=kotlin.String value='OK'
IrFunction public fun kotlin.String.test5(): kotlin.String
IrExpressionBody
RETURN type=kotlin.String
GET_PROPERTY .okext
$receiver: $RECEIVER of: test5
GET_PROPERTY .okext
$receiver: $RECEIVER of: test5
+1 -2
View File
@@ -1,4 +1,3 @@
IrProperty public val testSimpleVal: kotlin.Int = 1 getter=null setter=null
IrExpressionBody
RETURN type=kotlin.Int
LITERAL Int type=kotlin.Int value='1'
LITERAL Int type=kotlin.Int value='1'
+4 -8
View File
@@ -6,22 +6,18 @@ IrFile /smoke.kt
LITERAL String type=kotlin.String value='OK'
IrProperty public val testSimpleVal: kotlin.Int = 1 getter=null setter=null
IrExpressionBody
RETURN type=kotlin.Int
LITERAL Int type=kotlin.Int value='1'
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
RETURN type=kotlin.Int
LITERAL Int type=kotlin.Int value='42'
LITERAL Int type=kotlin.Int value='42'
IrProperty public var testSimpleVar: kotlin.Int getter=null setter=null
IrExpressionBody
RETURN type=kotlin.Int
LITERAL Int type=kotlin.Int value='2'
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
RETURN type=kotlin.Int
LITERAL Int type=kotlin.Int value='42'
LITERAL Int type=kotlin.Int value='42'
IrPropertySetter public fun <set-testVarWithAccessors>(/*0*/ v: kotlin.Int): kotlin.Unit property=testVarWithAccessors
IrExpressionBody
BLOCK type=kotlin.Unit