[go: nahoru, domu]

blob: 2458736cff46974ac540e07f8cde661aa611f692 [file] [log] [blame]
//
// Source
// ------------------------------------------
import androidx.compose.runtime.Composable
import androidx.compose.runtime.ReadOnlyComposable
import androidx.compose.runtime.key
import androidx.compose.runtime.NonRestartableComposable
@NonRestartableComposable @Composable
fun Example(x: Int) {
// composable calls are in the condition blocks of the when statement. Since these
// are conditionally executed, we can't statically know the number of groups during
// execution. as a result, we must wrap the when clause with a group. Since there
// are no other composable calls, the function body group will suffice.
when {
x == R(a) -> NA()
x > R(b) -> NA()
else -> NA()
}
}
//
// Transformed IR
// ------------------------------------------
@NonRestartableComposable
@Composable
fun Example(x: Int, %composer: Composer?, %changed: Int) {
sourceInformationMarkerStart(%composer, <>, "C(Example):Test.kt")
if (isTraceInProgress()) {
traceEventStart(<>, %changed, -1, <>)
}
%composer.startReplaceableGroup(<>)
sourceInformation(%composer, "")
when {
%composer.startReplaceableGroup(<>)
sourceInformation(%composer, "<R(a)>")
val tmp0_group = x == R(a, %composer, 0)
%composer.endReplaceableGroup()
tmp0_group -> {
NA()
}
%composer.startReplaceableGroup(<>)
sourceInformation(%composer, "<R(b)>")
val tmp1_group = x > R(b, %composer, 0)
%composer.endReplaceableGroup()
tmp1_group -> {
NA()
}
else -> {
NA()
}
}
%composer.endReplaceableGroup()
if (isTraceInProgress()) {
traceEventEnd()
}
sourceInformationMarkerEnd(%composer)
}