blob: e2607bde1e26e657da8042caa1d838b144385e17 [file] [log] [blame]
//
// Source
// ------------------------------------------
import androidx.compose.runtime.Composable
import androidx.compose.runtime.NonRestartableComposable
@Composable
fun Example(foo: Foo = Foo(0)) {
print(foo)
}
@Composable
fun Test() {
Example()
}
//
// Transformed IR
// ------------------------------------------
@Composable
fun Example(foo: Foo, %composer: Composer?, %changed: Int, %default: Int) {
%composer = %composer.startRestartGroup(<>)
sourceInformation(%composer, "C(Example)P(0:Foo):Test.kt")
val %dirty = %changed
if (%default and 0b0001 != 0) {
%dirty = %dirty or 0b0110
} else if (%changed and 0b0110 == 0) {
%dirty = %dirty or if (%composer.changed(<unsafe-coerce>(foo))) 0b0100 else 0b0010
}
if (%dirty and 0b0011 != 0b0010 || !%composer.skipping) {
if (%default and 0b0001 != 0) {
foo = Foo(0)
}
if (isTraceInProgress()) {
traceEventStart(<>, %dirty, -1, <>)
}
print(foo)
if (isTraceInProgress()) {
traceEventEnd()
}
} else {
%composer.skipToGroupEnd()
}
%composer.endRestartGroup()?.updateScope { %composer: Composer?, %force: Int ->
Example(foo, %composer, updateChangedFlags(%changed or 0b0001), %default)
}
}
@Composable
fun Test(%composer: Composer?, %changed: Int) {
%composer = %composer.startRestartGroup(<>)
sourceInformation(%composer, "C(Test)<Exampl...>:Test.kt")
if (%changed != 0 || !%composer.skipping) {
if (isTraceInProgress()) {
traceEventStart(<>, %changed, -1, <>)
}
Example(<unsafe-coerce>(0), %composer, 0, 0b0001)
if (isTraceInProgress()) {
traceEventEnd()
}
} else {
%composer.skipToGroupEnd()
}
%composer.endRestartGroup()?.updateScope { %composer: Composer?, %force: Int ->
Test(%composer, updateChangedFlags(%changed or 0b0001))
}
}