Desugar basic binary operators (+, -, *, /, %, ..).
Fold String.plus calls to IrStringConcatenationExpression.
This commit is contained in:
committed by
Dmitry Petrov
parent
287d804131
commit
1b018a6ead
+3
-1
@@ -8,7 +8,9 @@ IrFile /assignments.kt
|
||||
SET_VAR x type=<no-type>
|
||||
LITERAL Int type=kotlin.Int value='1'
|
||||
SET_VAR x type=<no-type>
|
||||
DUMMY PLUS type=kotlin.Int
|
||||
CALL .plus type=kotlin.Int operator=PLUS
|
||||
$this: GET_VAR x type=kotlin.Int
|
||||
other: LITERAL Int type=kotlin.Int value='1'
|
||||
IrFunction public fun test2(/*0*/ r: Ref): kotlin.Unit
|
||||
IrExpressionBody
|
||||
BLOCK type=<no-type> hasResult=false isDesugared=false
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
fun test1(a: Int, b: Int) = a + b
|
||||
fun test2(a: Int, b: Int) = a - b
|
||||
fun test3(a: Int, b: Int) = a * b
|
||||
fun test4(a: Int, b: Int) = a / b
|
||||
fun test5(a: Int, b: Int) = a % b
|
||||
fun test6(a: Int, b: Int) = a .. b
|
||||
+43
@@ -0,0 +1,43 @@
|
||||
IrFile /simpleOperators.kt
|
||||
IrFunction public fun test1(/*0*/ a: kotlin.Int, /*1*/ b: kotlin.Int): kotlin.Int
|
||||
IrExpressionBody
|
||||
BLOCK type=<no-type> hasResult=false isDesugared=true
|
||||
RETURN type=<no-type>
|
||||
CALL .plus type=kotlin.Int operator=PLUS
|
||||
$this: GET_VAR a type=kotlin.Int
|
||||
other: GET_VAR b type=kotlin.Int
|
||||
IrFunction public fun test2(/*0*/ a: kotlin.Int, /*1*/ b: kotlin.Int): kotlin.Int
|
||||
IrExpressionBody
|
||||
BLOCK type=<no-type> hasResult=false isDesugared=true
|
||||
RETURN type=<no-type>
|
||||
CALL .minus type=kotlin.Int operator=MINUS
|
||||
$this: GET_VAR a type=kotlin.Int
|
||||
other: GET_VAR b type=kotlin.Int
|
||||
IrFunction public fun test3(/*0*/ a: kotlin.Int, /*1*/ b: kotlin.Int): kotlin.Int
|
||||
IrExpressionBody
|
||||
BLOCK type=<no-type> hasResult=false isDesugared=true
|
||||
RETURN type=<no-type>
|
||||
CALL .times type=kotlin.Int operator=MUL
|
||||
$this: GET_VAR a type=kotlin.Int
|
||||
other: GET_VAR b type=kotlin.Int
|
||||
IrFunction public fun test4(/*0*/ a: kotlin.Int, /*1*/ b: kotlin.Int): kotlin.Int
|
||||
IrExpressionBody
|
||||
BLOCK type=<no-type> hasResult=false isDesugared=true
|
||||
RETURN type=<no-type>
|
||||
CALL .div type=kotlin.Int operator=DIV
|
||||
$this: GET_VAR a type=kotlin.Int
|
||||
other: GET_VAR b type=kotlin.Int
|
||||
IrFunction public fun test5(/*0*/ a: kotlin.Int, /*1*/ b: kotlin.Int): kotlin.Int
|
||||
IrExpressionBody
|
||||
BLOCK type=<no-type> hasResult=false isDesugared=true
|
||||
RETURN type=<no-type>
|
||||
CALL .mod type=kotlin.Int operator=PERC
|
||||
$this: GET_VAR a type=kotlin.Int
|
||||
other: GET_VAR b type=kotlin.Int
|
||||
IrFunction public fun test6(/*0*/ a: kotlin.Int, /*1*/ b: kotlin.Int): kotlin.ranges.IntRange
|
||||
IrExpressionBody
|
||||
BLOCK type=<no-type> hasResult=false isDesugared=true
|
||||
RETURN type=<no-type>
|
||||
CALL .rangeTo type=kotlin.ranges.IntRange operator=RANGE
|
||||
$this: GET_VAR a type=kotlin.Int
|
||||
other: GET_VAR b type=kotlin.Int
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
fun test1(a: String, b: Any) = a + b
|
||||
fun test2(a: String, b: Int) = a + "+" + b
|
||||
fun test3(a: String, b: Int) = (a + "+") + (b + 1) + a
|
||||
+27
@@ -0,0 +1,27 @@
|
||||
IrFile /stringPlus.kt
|
||||
IrFunction public fun test1(/*0*/ a: kotlin.String, /*1*/ b: kotlin.Any): kotlin.String
|
||||
IrExpressionBody
|
||||
BLOCK type=<no-type> hasResult=false isDesugared=true
|
||||
RETURN type=<no-type>
|
||||
STRING_CONCATENATION type=kotlin.String
|
||||
GET_VAR a type=kotlin.String
|
||||
GET_VAR b type=kotlin.Any
|
||||
IrFunction public fun test2(/*0*/ a: kotlin.String, /*1*/ b: kotlin.Int): kotlin.String
|
||||
IrExpressionBody
|
||||
BLOCK type=<no-type> hasResult=false isDesugared=true
|
||||
RETURN type=<no-type>
|
||||
STRING_CONCATENATION type=kotlin.String
|
||||
GET_VAR a type=kotlin.String
|
||||
LITERAL String type=kotlin.String value='+'
|
||||
GET_VAR b type=kotlin.Int
|
||||
IrFunction public fun test3(/*0*/ a: kotlin.String, /*1*/ b: kotlin.Int): kotlin.String
|
||||
IrExpressionBody
|
||||
BLOCK type=<no-type> hasResult=false isDesugared=true
|
||||
RETURN type=<no-type>
|
||||
STRING_CONCATENATION type=kotlin.String
|
||||
GET_VAR a type=kotlin.String
|
||||
LITERAL String type=kotlin.String value='+'
|
||||
CALL .plus type=kotlin.Int operator=PLUS
|
||||
$this: GET_VAR b type=kotlin.Int
|
||||
other: LITERAL Int type=kotlin.Int value='1'
|
||||
GET_VAR a type=kotlin.String
|
||||
Reference in New Issue
Block a user