FIR/UAST: commonize if expression

This commit is contained in:
Jinseong Jeon
2021-05-26 23:59:25 -07:00
committed by Ilya Kirillov
parent 50f750187b
commit 6e1b04e4c9
10 changed files with 82 additions and 38 deletions
+6
View File
@@ -0,0 +1,6 @@
fun test(b: Boolean): Any {
return if (b)
42
else
"42"
}
@@ -0,0 +1,11 @@
UFile (package = )
UClass (name = IfKt)
UMethod (name = test)
UParameter (name = b)
UAnnotation (fqName = org.jetbrains.annotations.NotNull)
UBlockExpression
UReturnExpression
UIfExpression
USimpleNameReferenceExpression (identifier = b)
ULiteralExpression (value = 42)
ULiteralExpression (value = "42")
@@ -0,0 +1,10 @@
UFile (package = )
UClass (name = IfKt)
UMethod (name = test)
UParameter (name = b)
UBlockExpression
UReturnExpression
UIfExpression
[!] UnknownKotlinExpression (REFERENCE_EXPRESSION)
ULiteralExpression (value = "not-yet-compile-time-constant")
ULiteralExpression (value = "42")
@@ -0,0 +1,5 @@
public final class IfKt {
public static final fun test(@org.jetbrains.annotations.NotNull b: boolean) : java.lang.Object {
return if (b) 42 else "42"
}
}
@@ -0,0 +1,5 @@
public final class IfKt {
public static final fun test(b: boolean) : java.lang.Object {
return if ([!] UnknownKotlinExpression (REFERENCE_EXPRESSION)) "not-yet-compile-time-constant" else "42"
}
}