In last year’s <ADS session about the new Modifier...
# compose
l
In last year’s

ADS session about the new Modifier.Node APIs

one of the first reasoning put forward is that
Modifier.composed{}
is not skippable since it has a returns a value. I’m little confused with this 🤔
Modifier.composed
itself is a non-@Composable function hence it’ll be non-skippable anyways. • Or is Leland pointing out to the @Composable lambda being non-skippable (which is
true
). Tried looking for the logic that matched what Leland said and the slide in ComposableFunctionBodyTransformer. Would be great if anyone could help clarify this part and if there’s any source to it. 🙇
1
s
.composed contains a composable lambda which is executed (materialized) when layout nodes are created that lambda returns a value, which makes it non-skippable
🙌 1
blob smile 1
a
The latter. He mentioned the
materialize
API which will expand a composed modifier by executing the composable lambda. Also I don't understand how this has anything to do with ComposableFunctionBodyTransformer.
🙌 1
blob smile 1
l
Thanks a lot!! Now its clear why the arrow points there 😅
I don’t understand how this has anything to do with ComposableFunctionBodyTransformer.
I was just looking for any hints regarding the skippable fact. ComposableFunctionBodyTransformer has some hints regarding restartable @Composables so I thought if I could find anything there.
Copy code
// Currently, we make all composable functions restartable by default, unless:
// 1. They are inline
// 2. They have a return value (may get relaxed in the future)
// 3. They are a lambda (we use ComposableLambda<...> class for this instead)
// 4. They are annotated as @NonRestartableComposable
private fun IrFunction.shouldBeRestartable(): Boolean {..}