FIR/UAST: commonize if expression
This commit is contained in:
committed by
Ilya Kirillov
parent
50f750187b
commit
6e1b04e4c9
@@ -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"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user