Files
kotlin-fork/compiler/testData/ir/irText/expressions/incrementDecrement.kt.txt
T
Dmitriy Novozhilov b454fcc1e0 [FIR] Save IR dumps to .ir.txt files instead of .txt in tests
This is needed to avoid clashes between different dumps from different
  handlers
2021-10-12 17:26:36 +03:00

98 lines
1.9 KiB
Plaintext
Vendored

var p: Int
field = 0
get
set
val arr: IntArray
field = intArrayOf(elements = [1, 2, 3])
get
fun testVarPrefix() {
var x: Int = 0
val x1: Int = { // BLOCK
x = x.inc()
x
}
val x2: Int = { // BLOCK
x = x.dec()
x
}
}
fun testVarPostfix() {
var x: Int = 0
val x1: Int = { // BLOCK
val tmp0: Int = x
x = tmp0.inc()
tmp0
}
val x2: Int = { // BLOCK
val tmp1: Int = x
x = tmp1.dec()
tmp1
}
}
fun testPropPrefix() {
val p1: Int = { // BLOCK
{ // BLOCK
<set-p>(<set-?> = <get-p>().inc())
<get-p>()
}
}
val p2: Int = { // BLOCK
{ // BLOCK
<set-p>(<set-?> = <get-p>().dec())
<get-p>()
}
}
}
fun testPropPostfix() {
val p1: Int = { // BLOCK
{ // BLOCK
val tmp0: Int = <get-p>()
<set-p>(<set-?> = tmp0.inc())
tmp0
}
}
val p2: Int = { // BLOCK
{ // BLOCK
<set-p>(<set-?> = <get-p>().dec())
<get-p>()
}
}
}
fun testArrayPrefix() {
val a1: Int = { // BLOCK
val tmp0_array: IntArray = <get-arr>()
val tmp1_index0: Int = 0
tmp0_array.set(index = tmp1_index0, value = tmp0_array.get(index = tmp1_index0).inc())
tmp0_array.get(index = tmp1_index0)
}
val a2: Int = { // BLOCK
val tmp2_array: IntArray = <get-arr>()
val tmp3_index0: Int = 0
tmp2_array.set(index = tmp3_index0, value = tmp2_array.get(index = tmp3_index0).dec())
tmp2_array.get(index = tmp3_index0)
}
}
fun testArrayPostfix() {
val a1: Int = { // BLOCK
val tmp0_array: IntArray = <get-arr>()
val tmp1_index0: Int = 0
val tmp2: Int = tmp0_array.get(index = tmp1_index0)
tmp0_array.set(index = tmp1_index0, value = tmp2.inc())
tmp2
}
val a2: Int = { // BLOCK
val tmp3_array: IntArray = <get-arr>()
val tmp4_index0: Int = 0
val tmp5: Int = tmp3_array.get(index = tmp4_index0)
tmp3_array.set(index = tmp4_index0, value = tmp5.dec())
tmp5
}
}