Adds Compose lint check for unnecessary lambda creation
This will warn for cases where a new lambda is created just to
invoke an already captured lambda, such as:
val lambda = @Composable {} Foo { lambda() }
This can be inlined to just:
Foo(lambda)
Also cleans up existing cases where this was being done.
Note: this lint check is only enabled for library code, not tests - but
I cleaned up existing test and benchmark issues as a one-off fix.
Bug: b/142240063
Test: ./gradlew lintDebug
Change-Id: I2d9677c26b98a7b45ef70f2c944f4b4a3af17b06
diff --git a/buildSrc/lint-checks/build.gradle b/buildSrc/lint-checks/build.gradle
index 6654f39..a6c575a 100644
--- a/buildSrc/lint-checks/build.gradle
+++ b/buildSrc/lint-checks/build.gradle
@@ -14,11 +14,10 @@
* limitations under the License.
*/
-apply plugin: 'org.jetbrains.kotlin.jvm'
+apply plugin: 'kotlin'
dependencies {
- implementation build_libs.lint.core
- implementation build_libs.lint.api
- implementation build_libs.kotlin.stdlib
- api("androidx.annotation:annotation:1.0.0")
+ compileOnly build_libs.lint.api
+ compileOnly build_libs.kotlin.stdlib
+ implementation "androidx.annotation:annotation:1.0.0"
}
diff --git a/buildSrc/lint-checks/src/main/java/androidx/build/lint/AndroidXIssueRegistry.kt b/buildSrc/lint-checks/src/main/java/androidx/build/lint/AndroidXIssueRegistry.kt
index 7170927..7cdc6d6 100644
--- a/buildSrc/lint-checks/src/main/java/androidx/build/lint/AndroidXIssueRegistry.kt
+++ b/buildSrc/lint-checks/src/main/java/androidx/build/lint/AndroidXIssueRegistry.kt
@@ -17,8 +17,10 @@
package androidx.build.lint
import com.android.tools.lint.client.api.IssueRegistry
+import com.android.tools.lint.detector.api.CURRENT_API
class AndroidXIssueRegistry : IssueRegistry() {
+ override val api = CURRENT_API
override val issues get() = listOf(
BanParcelableUsage.ISSUE,
BanKeepAnnotation.ISSUE,
diff --git a/buildSrc/src/main/kotlin/androidx/build/AndroidXUiPlugin.kt b/buildSrc/src/main/kotlin/androidx/build/AndroidXUiPlugin.kt
index f97a548..4edd1ab 100644
--- a/buildSrc/src/main/kotlin/androidx/build/AndroidXUiPlugin.kt
+++ b/buildSrc/src/main/kotlin/androidx/build/AndroidXUiPlugin.kt
@@ -43,6 +43,12 @@
targetSdkVersion(29)
}
+ // TODO: figure out how to apply this to multiplatform modules
+ project.dependencies.add(
+ "lintChecks",
+ project.rootProject.project(":ui:ui-internal-lint-checks")
+ )
+
library.lintOptions.apply {
// Too many Kotlin features require synthetic accessors - we want to rely on R8 to
// remove these accessors
diff --git a/compose/compose-runtime/compose-runtime-benchmark/src/androidTest/java/androidx/compose/benchmark/ComposeBenchmarkBase.kt b/compose/compose-runtime/compose-runtime-benchmark/src/androidTest/java/androidx/compose/benchmark/ComposeBenchmarkBase.kt
index 29fd820..78e9e85 100644
--- a/compose/compose-runtime/compose-runtime-benchmark/src/androidTest/java/androidx/compose/benchmark/ComposeBenchmarkBase.kt
+++ b/compose/compose-runtime/compose-runtime-benchmark/src/androidTest/java/androidx/compose/benchmark/ComposeBenchmarkBase.kt
@@ -39,9 +39,7 @@
fun measureCompose(block: @Composable() () -> Unit) {
val activity = activityRule.activity
benchmarkRule.measureRepeated {
- activity.setContent {
- block()
- }
+ activity.setContent(block)
runWithTimingDisabled {
activity.setContent { }
diff --git a/compose/compose-runtime/compose-runtime-benchmark/src/androidTest/java/androidx/compose/benchmark/DbMonsterBenchmark.kt b/compose/compose-runtime/compose-runtime-benchmark/src/androidTest/java/androidx/compose/benchmark/DbMonsterBenchmark.kt
index 5ba2125..a9787c1 100644
--- a/compose/compose-runtime/compose-runtime-benchmark/src/androidTest/java/androidx/compose/benchmark/DbMonsterBenchmark.kt
+++ b/compose/compose-runtime/compose-runtime-benchmark/src/androidTest/java/androidx/compose/benchmark/DbMonsterBenchmark.kt
@@ -18,10 +18,11 @@
import androidx.compose.benchmark.dbmonster.DatabaseList
import androidx.compose.benchmark.dbmonster.DatabaseRow
-import androidx.compose.benchmark.dbmonster.Table
import androidx.test.annotation.UiThreadTest
import androidx.test.ext.junit.runners.AndroidJUnit4
import androidx.test.filters.LargeTest
+import androidx.ui.layout.Column
+import androidx.ui.layout.ExpandedHeight
import org.junit.FixMethodOrder
import org.junit.Test
import org.junit.runner.RunWith
@@ -59,7 +60,7 @@
val list = DatabaseList(count, random)
measureRecompose {
compose {
- Table {
+ Column(ExpandedHeight) {
for (db in list.databases) {
DatabaseRow(db = db)
}
diff --git a/compose/compose-runtime/compose-runtime-benchmark/src/androidTest/java/androidx/compose/benchmark/dbmonster/DbMonster.kt b/compose/compose-runtime/compose-runtime-benchmark/src/androidTest/java/androidx/compose/benchmark/dbmonster/DbMonster.kt
index b625041..8f8b11e 100644
--- a/compose/compose-runtime/compose-runtime-benchmark/src/androidTest/java/androidx/compose/benchmark/dbmonster/DbMonster.kt
+++ b/compose/compose-runtime/compose-runtime-benchmark/src/androidTest/java/androidx/compose/benchmark/dbmonster/DbMonster.kt
@@ -44,9 +44,7 @@
@Model
class Database(var name: String, val random: Random) {
var queries: List<Query> = (1..10).map {
- Query(
- random
- )
+ Query(random)
}
fun topQueries(n: Int): List<Query> {
return queries/*.sortedByDescending { it.elapsed }*/.take(n)
@@ -73,11 +71,6 @@
}
@Composable
-fun Table(children: @Composable() () -> Unit) {
- Column(ExpandedHeight) { children() }
-}
-
-@Composable
fun QueryColumn(query: Query) {
// TODO: we could do some conditional styling here which would make the test better
Column(ExpandedHeight) {
diff --git a/compose/compose-runtime/compose-runtime-benchmark/src/androidTest/java/androidx/compose/benchmark/deeptree/DeepTree.kt b/compose/compose-runtime/compose-runtime-benchmark/src/androidTest/java/androidx/compose/benchmark/deeptree/DeepTree.kt
index ac20439..60db6db 100644
--- a/compose/compose-runtime/compose-runtime-benchmark/src/androidTest/java/androidx/compose/benchmark/deeptree/DeepTree.kt
+++ b/compose/compose-runtime/compose-runtime-benchmark/src/androidTest/java/androidx/compose/benchmark/deeptree/DeepTree.kt
@@ -23,6 +23,7 @@
import androidx.ui.layout.Column
import androidx.ui.layout.ExpandedHeight
import androidx.ui.layout.ExpandedWidth
+import androidx.ui.layout.FlexScope
import androidx.ui.layout.Row
@Composable
@@ -36,11 +37,11 @@
}
@Composable
-fun Stack(vertical: Boolean, children: @Composable() () -> Unit) {
+fun Stack(vertical: Boolean, children: @Composable() FlexScope.() -> Unit) {
if (vertical) {
- Column(ExpandedHeight) { children() }
+ Column(ExpandedHeight, block = children)
} else {
- Row(ExpandedWidth) { children() }
+ Row(ExpandedWidth, block = children)
}
}
diff --git a/compose/compose-runtime/compose-runtime-benchmark/src/androidTest/java/androidx/compose/benchmark/realworld4/RealWorld4_Widgets.kt b/compose/compose-runtime/compose-runtime-benchmark/src/androidTest/java/androidx/compose/benchmark/realworld4/RealWorld4_Widgets.kt
index 02bb5ba..2d18bc2 100644
--- a/compose/compose-runtime/compose-runtime-benchmark/src/androidTest/java/androidx/compose/benchmark/realworld4/RealWorld4_Widgets.kt
+++ b/compose/compose-runtime/compose-runtime-benchmark/src/androidTest/java/androidx/compose/benchmark/realworld4/RealWorld4_Widgets.kt
@@ -141,7 +141,7 @@
model = model.f15
)
}
- flexible(flex = 1f) { children(); }
+ flexible(flex = 1f, children = children)
}
} else {
FlexRow {
@@ -151,7 +151,7 @@
model = model.f15
)
}
- flexible(flex = 1f) { children(); }
+ flexible(flex = 1f, children = children)
}
}
}
@@ -314,8 +314,9 @@
) {
RealWorld4_FancyWidget_007(
number = 55,
- model = model.f5.f2.f0.f11
- ) { children(); }
+ model = model.f5.f2.f0.f11,
+ children = children
+ )
}
}
}
@@ -347,8 +348,9 @@
) {
RealWorld4_FancyWidget_007(
number = 56,
- model = model.f5.f2.f0.f11
- ) { children(); }
+ model = model.f5.f2.f0.f11,
+ children = children
+ )
}
}
}
@@ -401,8 +403,9 @@
number = 310,
s1 = "HelloWorld",
model = model.f0,
- s2 = "HelloWorld"
- ) { children(); }
+ s2 = "HelloWorld",
+ children = children
+ )
}
flexible(flex = 1f) {
RealWorld4_FancyWidget_139(model = model.f2) {
@@ -422,8 +425,9 @@
number = 351,
s1 = "HelloWorld",
model = model.f0,
- s2 = "HelloWorld"
- ) { children(); }
+ s2 = "HelloWorld",
+ children = children
+ )
}
flexible(flex = 1f) {
RealWorld4_FancyWidget_139(model = model.f2) {
@@ -488,8 +492,9 @@
RealWorld4_FancyWidget_133(
model = model.f0,
s1 = "HelloWorld",
- s2 = "HelloWorld"
- ) { children(); }
+ s2 = "HelloWorld",
+ children = children
+ )
}
flexible(flex = 1f) {
RealWorld4_FancyWidget_075(
@@ -528,8 +533,9 @@
RealWorld4_FancyWidget_133(
model = model.f0,
s1 = "HelloWorld",
- s2 = "HelloWorld"
- ) { children(); }
+ s2 = "HelloWorld",
+ children = children
+ )
}
flexible(flex = 1f) {
RealWorld4_FancyWidget_075(
@@ -614,7 +620,7 @@
) { ColoredRect(model.toColor()); }
}
}
- flexible(flex = 1f) { children(); }
+ flexible(flex = 1f, children = children)
}
} else {
FlexRow {
@@ -633,7 +639,7 @@
) { ColoredRect(model.toColor()); }
}
}
- flexible(flex = 1f) { children(); }
+ flexible(flex = 1f, children = children)
}
}
}
@@ -687,7 +693,7 @@
}
}
flexible(flex = 1f) {
- RealWorld4_FancyWidget_085(model = model.f7) { children(); }
+ RealWorld4_FancyWidget_085(model = model.f7, children = children)
}
}
} else {
@@ -708,7 +714,7 @@
}
}
flexible(flex = 1f) {
- RealWorld4_FancyWidget_085(model = model.f7) { children(); }
+ RealWorld4_FancyWidget_085(model = model.f7, children = children)
}
}
}
@@ -752,7 +758,7 @@
s1 = "HelloWorld"
) { ColoredRect(model.toColor()); }
}
- flexible(flex = 1f) { children(); }
+ flexible(flex = 1f, children = children)
}
} else {
FlexRow {
@@ -762,7 +768,7 @@
s1 = "HelloWorld"
) { ColoredRect(model.toColor()); }
}
- flexible(flex = 1f) { children(); }
+ flexible(flex = 1f, children = children)
}
}
}
@@ -806,7 +812,7 @@
model = model.f5
) { ColoredRect(model.toColor()); }
}
- flexible(flex = 1f) { children(); }
+ flexible(flex = 1f, children = children)
}
} else {
FlexRow {
@@ -817,7 +823,7 @@
model = model.f5
) { ColoredRect(model.toColor()); }
}
- flexible(flex = 1f) { children(); }
+ flexible(flex = 1f, children = children)
}
}
}
@@ -861,12 +867,12 @@
if (constraints.maxHeight > constraints.maxWidth) {
FlexColumn {
flexible(flex = 1f) { ColoredRect(model.toColor()); }
- flexible(flex = 1f) { children(); }
+ flexible(flex = 1f, children = children)
}
} else {
FlexRow {
flexible(flex = 1f) { ColoredRect(model.toColor()); }
- flexible(flex = 1f) { children(); }
+ flexible(flex = 1f, children = children)
}
}
}
@@ -945,8 +951,9 @@
flexible(flex = 1f) {
RealWorld4_FancyWidget_091(
model = model.f2,
- s1 = "HelloWorld"
- ) { children(); }
+ s1 = "HelloWorld",
+ children = children
+ )
}
flexible(flex = 1f) {
RealWorld4_FancyWidget_110(
@@ -962,8 +969,9 @@
flexible(flex = 1f) {
RealWorld4_FancyWidget_091(
model = model.f2,
- s1 = "HelloWorld"
- ) { children(); }
+ s1 = "HelloWorld",
+ children = children
+ )
}
flexible(flex = 1f) {
RealWorld4_FancyWidget_110(
@@ -1010,12 +1018,12 @@
if (constraints.maxHeight > constraints.maxWidth) {
FlexColumn {
flexible(flex = 1f) { ColoredRect(model.toColor()); }
- flexible(flex = 1f) { children(); }
+ flexible(flex = 1f, children = children)
}
} else {
FlexRow {
flexible(flex = 1f) { ColoredRect(model.toColor()); }
- flexible(flex = 1f) { children(); }
+ flexible(flex = 1f, children = children)
}
}
}
@@ -1053,12 +1061,12 @@
if (constraints.maxHeight > constraints.maxWidth) {
FlexColumn {
flexible(flex = 1f) { ColoredRect(model.toColor()); }
- flexible(flex = 1f) { children(); }
+ flexible(flex = 1f, children = children)
}
} else {
FlexRow {
flexible(flex = 1f) { ColoredRect(model.toColor()); }
- flexible(flex = 1f) { children(); }
+ flexible(flex = 1f, children = children)
}
}
}
@@ -1113,7 +1121,7 @@
) { ColoredRect(model.toColor()); }
}
}
- flexible(flex = 1f) { children(); }
+ flexible(flex = 1f, children = children)
}
} else {
FlexRow {
@@ -1129,7 +1137,7 @@
) { ColoredRect(model.toColor()); }
}
}
- flexible(flex = 1f) { children(); }
+ flexible(flex = 1f, children = children)
}
}
}
@@ -1178,8 +1186,9 @@
number = 915,
obj = RealWorld4_UnmemoizablePojo_12(),
b = true,
- model = model.f5
- ) { children(); }
+ model = model.f5,
+ children = children
+ )
}
}
} else {
@@ -1196,8 +1205,9 @@
number = 775,
obj = RealWorld4_UnmemoizablePojo_12(),
b = true,
- model = model.f5
- ) { children(); }
+ model = model.f5,
+ children = children
+ )
}
}
}
@@ -1357,12 +1367,12 @@
if (constraints.maxHeight > constraints.maxWidth) {
FlexColumn {
flexible(flex = 1f) { ColoredRect(model.toColor()); }
- flexible(flex = 1f) { children(); }
+ flexible(flex = 1f, children = children)
}
} else {
FlexRow {
flexible(flex = 1f) { ColoredRect(model.toColor()); }
- flexible(flex = 1f) { children(); }
+ flexible(flex = 1f, children = children)
}
}
}
@@ -1412,12 +1422,12 @@
if (constraints.maxHeight > constraints.maxWidth) {
FlexColumn {
flexible(flex = 1f) { ColoredRect(model.toColor()); }
- flexible(flex = 1f) { children(); }
+ flexible(flex = 1f, children = children)
}
} else {
FlexRow {
flexible(flex = 1f) { ColoredRect(model.toColor()); }
- flexible(flex = 1f) { children(); }
+ flexible(flex = 1f, children = children)
}
}
}
@@ -1446,12 +1456,12 @@
if (constraints.maxHeight > constraints.maxWidth) {
FlexColumn {
flexible(flex = 1f) { ColoredRect(model.toColor()); }
- flexible(flex = 1f) { children(); }
+ flexible(flex = 1f, children = children)
}
} else {
FlexRow {
flexible(flex = 1f) { ColoredRect(model.toColor()); }
- flexible(flex = 1f) { children(); }
+ flexible(flex = 1f, children = children)
}
}
}
@@ -1505,8 +1515,9 @@
RealWorld4_FancyWidget_015(
number = 667,
model = model.f5,
- s1 = "HelloWorld"
- ) { children(); }
+ s1 = "HelloWorld",
+ children = children
+ )
}
flexible(flex = 1f) {
RealWorld4_FancyWidget_045(
@@ -1529,8 +1540,9 @@
RealWorld4_FancyWidget_015(
number = 522,
model = model.f5,
- s1 = "HelloWorld"
- ) { children(); }
+ s1 = "HelloWorld",
+ children = children
+ )
}
flexible(flex = 1f) {
RealWorld4_FancyWidget_045(
@@ -1594,7 +1606,7 @@
obj = RealWorld4_UnmemoizablePojo_9()
) { ColoredRect(model.toColor()); }
}
- flexible(flex = 1f) { children(); }
+ flexible(flex = 1f, children = children)
}
} else {
FlexRow {
@@ -1604,7 +1616,7 @@
obj = RealWorld4_UnmemoizablePojo_9()
) { ColoredRect(model.toColor()); }
}
- flexible(flex = 1f) { children(); }
+ flexible(flex = 1f, children = children)
}
}
}
@@ -1653,7 +1665,7 @@
b = true
) { ColoredRect(model.toColor()); }
}
- flexible(flex = 1f) { children(); }
+ flexible(flex = 1f, children = children)
}
} else {
FlexRow {
@@ -1663,7 +1675,7 @@
b = false
) { ColoredRect(model.toColor()); }
}
- flexible(flex = 1f) { children(); }
+ flexible(flex = 1f, children = children)
}
}
}
@@ -1701,7 +1713,7 @@
if (constraints.maxHeight > constraints.maxWidth) {
FlexColumn {
flexible(flex = 1f) {
- RealWorld4_FancyWidget_138(model = model.f2) { children(); }
+ RealWorld4_FancyWidget_138(model = model.f2, children = children)
}
flexible(flex = 1f) {
RealWorld4_FancyWidget_050(
@@ -1713,7 +1725,7 @@
} else {
FlexRow {
flexible(flex = 1f) {
- RealWorld4_FancyWidget_138(model = model.f2) { children(); }
+ RealWorld4_FancyWidget_138(model = model.f2, children = children)
}
flexible(flex = 1f) {
RealWorld4_FancyWidget_050(
@@ -1764,12 +1776,12 @@
if (constraints.maxHeight > constraints.maxWidth) {
FlexColumn {
flexible(flex = 1f) { ColoredRect(model.toColor()); }
- flexible(flex = 1f) { children(); }
+ flexible(flex = 1f, children = children)
}
} else {
FlexRow {
flexible(flex = 1f) { ColoredRect(model.toColor()); }
- flexible(flex = 1f) { children(); }
+ flexible(flex = 1f, children = children)
}
}
}
@@ -1807,12 +1819,12 @@
if (constraints.maxHeight > constraints.maxWidth) {
FlexColumn {
flexible(flex = 1f) { ColoredRect(model.toColor()); }
- flexible(flex = 1f) { children(); }
+ flexible(flex = 1f, children = children)
}
} else {
FlexRow {
flexible(flex = 1f) { ColoredRect(model.toColor()); }
- flexible(flex = 1f) { children(); }
+ flexible(flex = 1f, children = children)
}
}
}
@@ -1910,7 +1922,7 @@
s2 = "HelloWorld"
) { ColoredRect(model.toColor()); }
}
- flexible(flex = 1f) { children(); }
+ flexible(flex = 1f, children = children)
}
} else {
FlexRow {
@@ -1920,7 +1932,7 @@
s2 = "HelloWorld"
) { ColoredRect(model.toColor()); }
}
- flexible(flex = 1f) { children(); }
+ flexible(flex = 1f, children = children)
}
}
}
@@ -1964,7 +1976,7 @@
model = model.f5
) { ColoredRect(model.toColor()); }
}
- flexible(flex = 1f) { children(); }
+ flexible(flex = 1f, children = children)
}
} else {
FlexRow {
@@ -1975,7 +1987,7 @@
model = model.f5
) { ColoredRect(model.toColor()); }
}
- flexible(flex = 1f) { children(); }
+ flexible(flex = 1f, children = children)
}
}
}
@@ -2056,12 +2068,12 @@
if (constraints.maxHeight > constraints.maxWidth) {
FlexColumn {
flexible(flex = 1f) { ColoredRect(model.toColor()); }
- flexible(flex = 1f) { children(); }
+ flexible(flex = 1f, children = children)
}
} else {
FlexRow {
flexible(flex = 1f) { ColoredRect(model.toColor()); }
- flexible(flex = 1f) { children(); }
+ flexible(flex = 1f, children = children)
}
}
}
@@ -2105,7 +2117,7 @@
s2 = "HelloWorld"
) { ColoredRect(model.toColor()); }
}
- flexible(flex = 1f) { children(); }
+ flexible(flex = 1f, children = children)
}
} else {
FlexRow {
@@ -2116,7 +2128,7 @@
s2 = "HelloWorld"
) { ColoredRect(model.toColor()); }
}
- flexible(flex = 1f) { children(); }
+ flexible(flex = 1f, children = children)
}
}
}
@@ -2160,12 +2172,12 @@
if (constraints.maxHeight > constraints.maxWidth) {
FlexColumn {
flexible(flex = 1f) { ColoredRect(model.toColor()); }
- flexible(flex = 1f) { children(); }
+ flexible(flex = 1f, children = children)
}
} else {
FlexRow {
flexible(flex = 1f) { ColoredRect(model.toColor()); }
- flexible(flex = 1f) { children(); }
+ flexible(flex = 1f, children = children)
}
}
}
@@ -2209,12 +2221,12 @@
if (constraints.maxHeight > constraints.maxWidth) {
FlexColumn {
flexible(flex = 1f) { ColoredRect(model.toColor()); }
- flexible(flex = 1f) { children(); }
+ flexible(flex = 1f, children = children)
}
} else {
FlexRow {
flexible(flex = 1f) { ColoredRect(model.toColor()); }
- flexible(flex = 1f) { children(); }
+ flexible(flex = 1f, children = children)
}
}
}
@@ -2252,12 +2264,12 @@
if (constraints.maxHeight > constraints.maxWidth) {
FlexColumn {
flexible(flex = 1f) { ColoredRect(model.toColor()); }
- flexible(flex = 1f) { children(); }
+ flexible(flex = 1f, children = children)
}
} else {
FlexRow {
flexible(flex = 1f) { ColoredRect(model.toColor()); }
- flexible(flex = 1f) { children(); }
+ flexible(flex = 1f, children = children)
}
}
}
@@ -2414,12 +2426,12 @@
if (constraints.maxHeight > constraints.maxWidth) {
FlexColumn {
flexible(flex = 1f) { RealWorld4_FancyWidget_054(model = model.f5); }
- flexible(flex = 1f) { children(); }
+ flexible(flex = 1f, children = children)
}
} else {
FlexRow {
flexible(flex = 1f) { RealWorld4_FancyWidget_054(model = model.f5); }
- flexible(flex = 1f) { children(); }
+ flexible(flex = 1f, children = children)
}
}
}
@@ -2471,8 +2483,9 @@
flexible(flex = 1f) {
RealWorld4_FancyWidget_040(
model = model.f4,
- s2 = "HelloWorld"
- ) { children(); }
+ s2 = "HelloWorld",
+ children = children
+ )
}
}
} else {
@@ -2486,8 +2499,9 @@
flexible(flex = 1f) {
RealWorld4_FancyWidget_040(
model = model.f4,
- s2 = "HelloWorld"
- ) { children(); }
+ s2 = "HelloWorld",
+ children = children
+ )
}
}
}
@@ -2531,7 +2545,7 @@
model = model.f2
)
}
- flexible(flex = 1f) { children(); }
+ flexible(flex = 1f, children = children)
}
} else {
FlexRow {
@@ -2541,7 +2555,7 @@
model = model.f2
)
}
- flexible(flex = 1f) { children(); }
+ flexible(flex = 1f, children = children)
}
}
}
@@ -2581,8 +2595,9 @@
flexible(flex = 1f) {
RealWorld4_FancyWidget_089(
model = model.f2,
- s2 = "HelloWorld"
- ) { children(); }
+ s2 = "HelloWorld",
+ children = children
+ )
}
flexible(flex = 1f) {
RealWorld4_FancyWidget_027(
@@ -2599,8 +2614,9 @@
flexible(flex = 1f) {
RealWorld4_FancyWidget_089(
model = model.f2,
- s2 = "HelloWorld"
- ) { children(); }
+ s2 = "HelloWorld",
+ children = children
+ )
}
flexible(flex = 1f) {
RealWorld4_FancyWidget_027(
@@ -2654,12 +2670,12 @@
if (constraints.maxHeight > constraints.maxWidth) {
FlexColumn {
flexible(flex = 1f) { ColoredRect(model.toColor()); }
- flexible(flex = 1f) { children(); }
+ flexible(flex = 1f, children = children)
}
} else {
FlexRow {
flexible(flex = 1f) { ColoredRect(model.toColor()); }
- flexible(flex = 1f) { children(); }
+ flexible(flex = 1f, children = children)
}
}
}
@@ -2722,7 +2738,7 @@
s1 = "HelloWorld"
) { ColoredRect(model.toColor()); }
}
- flexible(flex = 1f) { children(); }
+ flexible(flex = 1f, children = children)
}
} else {
FlexRow {
@@ -2733,7 +2749,7 @@
s1 = "HelloWorld"
) { ColoredRect(model.toColor()); }
}
- flexible(flex = 1f) { children(); }
+ flexible(flex = 1f, children = children)
}
}
}
@@ -2801,8 +2817,9 @@
flexible(flex = 1f) {
RealWorld4_FancyWidget_030(
s1 = "HelloWorld",
- model = model.f4
- ) { children(); }
+ model = model.f4,
+ children = children
+ )
}
}
} else {
@@ -2821,8 +2838,9 @@
flexible(flex = 1f) {
RealWorld4_FancyWidget_030(
s1 = "HelloWorld",
- model = model.f4
- ) { children(); }
+ model = model.f4,
+ children = children
+ )
}
}
}
@@ -2883,7 +2901,7 @@
number = 744
) { ColoredRect(model.toColor()); }
}
- flexible(flex = 1f) { children(); }
+ flexible(flex = 1f, children = children)
}
} else {
FlexRow {
@@ -2893,7 +2911,7 @@
number = 709
) { ColoredRect(model.toColor()); }
}
- flexible(flex = 1f) { children(); }
+ flexible(flex = 1f, children = children)
}
}
}
@@ -2936,7 +2954,7 @@
s2 = "HelloWorld"
)
}
- flexible(flex = 1f) { children(); }
+ flexible(flex = 1f, children = children)
}
} else {
FlexRow {
@@ -2946,7 +2964,7 @@
s2 = "HelloWorld"
)
}
- flexible(flex = 1f) { children(); }
+ flexible(flex = 1f, children = children)
}
}
}
@@ -2975,12 +2993,12 @@
if (constraints.maxHeight > constraints.maxWidth) {
FlexColumn {
flexible(flex = 1f) { ColoredRect(model.toColor()); }
- flexible(flex = 1f) { children(); }
+ flexible(flex = 1f, children = children)
}
} else {
FlexRow {
flexible(flex = 1f) { ColoredRect(model.toColor()); }
- flexible(flex = 1f) { children(); }
+ flexible(flex = 1f, children = children)
}
}
}
@@ -3018,12 +3036,12 @@
if (constraints.maxHeight > constraints.maxWidth) {
FlexColumn {
flexible(flex = 1f) { ColoredRect(model.toColor()); }
- flexible(flex = 1f) { children(); }
+ flexible(flex = 1f, children = children)
}
} else {
FlexRow {
flexible(flex = 1f) { ColoredRect(model.toColor()); }
- flexible(flex = 1f) { children(); }
+ flexible(flex = 1f, children = children)
}
}
}
@@ -3064,8 +3082,9 @@
RealWorld4_FancyWidget_107(
s2 = "HelloWorld",
model = model.f2,
- s1 = "HelloWorld"
- ) { children(); }
+ s1 = "HelloWorld",
+ children = children
+ )
}
flexible(flex = 1f) {
RealWorld4_FancyWidget_013(
@@ -3080,8 +3099,9 @@
RealWorld4_FancyWidget_107(
s2 = "HelloWorld",
model = model.f2,
- s1 = "HelloWorld"
- ) { children(); }
+ s1 = "HelloWorld",
+ children = children
+ )
}
flexible(flex = 1f) {
RealWorld4_FancyWidget_013(
@@ -3126,12 +3146,12 @@
if (constraints.maxHeight > constraints.maxWidth) {
FlexColumn {
flexible(flex = 1f) { ColoredRect(model.toColor()); }
- flexible(flex = 1f) { children(); }
+ flexible(flex = 1f, children = children)
}
} else {
FlexRow {
flexible(flex = 1f) { ColoredRect(model.toColor()); }
- flexible(flex = 1f) { children(); }
+ flexible(flex = 1f, children = children)
}
}
}
@@ -3169,12 +3189,12 @@
if (constraints.maxHeight > constraints.maxWidth) {
FlexColumn {
flexible(flex = 1f) { ColoredRect(model.toColor()); }
- flexible(flex = 1f) { children(); }
+ flexible(flex = 1f, children = children)
}
} else {
FlexRow {
flexible(flex = 1f) { ColoredRect(model.toColor()); }
- flexible(flex = 1f) { children(); }
+ flexible(flex = 1f, children = children)
}
}
}
@@ -3212,12 +3232,12 @@
if (constraints.maxHeight > constraints.maxWidth) {
FlexColumn {
flexible(flex = 1f) { ColoredRect(model.toColor()); }
- flexible(flex = 1f) { children(); }
+ flexible(flex = 1f, children = children)
}
} else {
FlexRow {
flexible(flex = 1f) { ColoredRect(model.toColor()); }
- flexible(flex = 1f) { children(); }
+ flexible(flex = 1f, children = children)
}
}
}
@@ -3368,7 +3388,7 @@
)
}
}
- flexible(flex = 1f) { children(); }
+ flexible(flex = 1f, children = children)
}
} else {
FlexRow {
@@ -3379,7 +3399,7 @@
)
}
}
- flexible(flex = 1f) { children(); }
+ flexible(flex = 1f, children = children)
}
}
}
@@ -3429,7 +3449,7 @@
s1 = "HelloWorld"
) { ColoredRect(model.toColor()); }
}
- flexible(flex = 1f) { children(); }
+ flexible(flex = 1f, children = children)
}
} else {
FlexRow {
@@ -3440,7 +3460,7 @@
s1 = "HelloWorld"
) { ColoredRect(model.toColor()); }
}
- flexible(flex = 1f) { children(); }
+ flexible(flex = 1f, children = children)
}
}
}
@@ -3490,12 +3510,12 @@
if (constraints.maxHeight > constraints.maxWidth) {
FlexColumn {
flexible(flex = 1f) { ColoredRect(model.toColor()); }
- flexible(flex = 1f) { children(); }
+ flexible(flex = 1f, children = children)
}
} else {
FlexRow {
flexible(flex = 1f) { ColoredRect(model.toColor()); }
- flexible(flex = 1f) { children(); }
+ flexible(flex = 1f, children = children)
}
}
}
@@ -3531,7 +3551,7 @@
b = false
) { ColoredRect(model.toColor()); }
}
- flexible(flex = 1f) { children(); }
+ flexible(flex = 1f, children = children)
}
} else {
FlexRow {
@@ -3543,7 +3563,7 @@
b = true
) { ColoredRect(model.toColor()); }
}
- flexible(flex = 1f) { children(); }
+ flexible(flex = 1f, children = children)
}
}
}
@@ -3587,12 +3607,12 @@
if (constraints.maxHeight > constraints.maxWidth) {
FlexColumn {
flexible(flex = 1f) { ColoredRect(model.toColor()); }
- flexible(flex = 1f) { children(); }
+ flexible(flex = 1f, children = children)
}
} else {
FlexRow {
flexible(flex = 1f) { ColoredRect(model.toColor()); }
- flexible(flex = 1f) { children(); }
+ flexible(flex = 1f, children = children)
}
}
}
@@ -3708,7 +3728,7 @@
if (constraints.maxHeight > constraints.maxWidth) {
FlexColumn {
flexible(flex = 1f) {
- RealWorld4_FancyWidget_019(model = model.f2) { children(); }
+ RealWorld4_FancyWidget_019(model = model.f2, children = children)
}
flexible(flex = 1f) {
RealWorld4_FancyWidget_064(
@@ -3720,7 +3740,7 @@
} else {
FlexRow {
flexible(flex = 1f) {
- RealWorld4_FancyWidget_019(model = model.f2) { children(); }
+ RealWorld4_FancyWidget_019(model = model.f2, children = children)
}
flexible(flex = 1f) {
RealWorld4_FancyWidget_064(
@@ -3771,12 +3791,12 @@
if (constraints.maxHeight > constraints.maxWidth) {
FlexColumn {
flexible(flex = 1f) { ColoredRect(model.toColor()); }
- flexible(flex = 1f) { children(); }
+ flexible(flex = 1f, children = children)
}
} else {
FlexRow {
flexible(flex = 1f) { ColoredRect(model.toColor()); }
- flexible(flex = 1f) { children(); }
+ flexible(flex = 1f, children = children)
}
}
}
@@ -3814,12 +3834,12 @@
if (constraints.maxHeight > constraints.maxWidth) {
FlexColumn {
flexible(flex = 1f) { ColoredRect(model.toColor()); }
- flexible(flex = 1f) { children(); }
+ flexible(flex = 1f, children = children)
}
} else {
FlexRow {
flexible(flex = 1f) { ColoredRect(model.toColor()); }
- flexible(flex = 1f) { children(); }
+ flexible(flex = 1f, children = children)
}
}
}
@@ -3907,12 +3927,12 @@
if (constraints.maxHeight > constraints.maxWidth) {
FlexColumn {
flexible(flex = 1f) { ColoredRect(model.toColor()); }
- flexible(flex = 1f) { children(); }
+ flexible(flex = 1f, children = children)
}
} else {
FlexRow {
flexible(flex = 1f) { ColoredRect(model.toColor()); }
- flexible(flex = 1f) { children(); }
+ flexible(flex = 1f, children = children)
}
}
}
@@ -3962,12 +3982,12 @@
if (constraints.maxHeight > constraints.maxWidth) {
FlexColumn {
flexible(flex = 1f) { ColoredRect(model.toColor()); }
- flexible(flex = 1f) { children(); }
+ flexible(flex = 1f, children = children)
}
} else {
FlexRow {
flexible(flex = 1f) { ColoredRect(model.toColor()); }
- flexible(flex = 1f) { children(); }
+ flexible(flex = 1f, children = children)
}
}
}
@@ -4026,7 +4046,7 @@
)
}
}
- flexible(flex = 1f) { children(); }
+ flexible(flex = 1f, children = children)
}
} else {
FlexRow {
@@ -4041,7 +4061,7 @@
)
}
}
- flexible(flex = 1f) { children(); }
+ flexible(flex = 1f, children = children)
}
}
}
@@ -4092,7 +4112,7 @@
model = model.f10
) { RealWorld4_FancyWidget_093(s1 = "HelloWorld", model = model.f10.f7); }
}
- flexible(flex = 1f) { children(); }
+ flexible(flex = 1f, children = children)
}
} else {
FlexRow {
@@ -4102,7 +4122,7 @@
model = model.f10
) { RealWorld4_FancyWidget_093(s1 = "HelloWorld", model = model.f10.f7); }
}
- flexible(flex = 1f) { children(); }
+ flexible(flex = 1f, children = children)
}
}
}
@@ -4150,8 +4170,9 @@
RealWorld4_FancyWidget_029(
b = true,
model = model.f5,
- s2 = "HelloWorld"
- ) { children(); }
+ s2 = "HelloWorld",
+ children = children
+ )
}
flexible(flex = 1f) {
RealWorld4_FancyWidget_148(
@@ -4166,8 +4187,9 @@
RealWorld4_FancyWidget_029(
b = true,
model = model.f5,
- s2 = "HelloWorld"
- ) { children(); }
+ s2 = "HelloWorld",
+ children = children
+ )
}
flexible(flex = 1f) {
RealWorld4_FancyWidget_148(
@@ -4224,8 +4246,9 @@
flexible(flex = 1f) {
RealWorld4_FancyWidget_073(
s1 = "HelloWorld",
- model = model.f0
- ) { children(); }
+ model = model.f0,
+ children = children
+ )
}
flexible(flex = 1f) {
RealWorld4_FancyWidget_072(
@@ -4239,8 +4262,9 @@
flexible(flex = 1f) {
RealWorld4_FancyWidget_073(
s1 = "HelloWorld",
- model = model.f0
- ) { children(); }
+ model = model.f0,
+ children = children
+ )
}
flexible(flex = 1f) {
RealWorld4_FancyWidget_072(
@@ -4290,7 +4314,7 @@
color = Color(red = 0xFF, blue = 0x99, green = 0x11)
) { ColoredRect(model.toColor()); }
}
- flexible(flex = 1f) { children(); }
+ flexible(flex = 1f, children = children)
}
} else {
FlexRow {
@@ -4300,7 +4324,7 @@
color = Color(red = 0xFF, blue = 0x99, green = 0x11)
) { ColoredRect(model.toColor()); }
}
- flexible(flex = 1f) { children(); }
+ flexible(flex = 1f, children = children)
}
}
}
@@ -4343,7 +4367,7 @@
s2 = "HelloWorld"
)
}
- flexible(flex = 1f) { children(); }
+ flexible(flex = 1f, children = children)
}
} else {
FlexRow {
@@ -4353,7 +4377,7 @@
s2 = "HelloWorld"
)
}
- flexible(flex = 1f) { children(); }
+ flexible(flex = 1f, children = children)
}
}
}
@@ -4439,7 +4463,7 @@
s2 = "HelloWorld"
) { RealWorld4_FancyWidget_078(model = model.f10.f5.f0, b = false); }
}
- flexible(flex = 1f) { children(); }
+ flexible(flex = 1f, children = children)
}
} else {
FlexRow {
@@ -4451,7 +4475,7 @@
s2 = "HelloWorld"
) { RealWorld4_FancyWidget_078(model = model.f10.f5.f0, b = true); }
}
- flexible(flex = 1f) { children(); }
+ flexible(flex = 1f, children = children)
}
}
}
@@ -4603,7 +4627,7 @@
) { ColoredRect(model.toColor()); }
}
}
- flexible(flex = 1f) { children(); }
+ flexible(flex = 1f, children = children)
}
} else {
FlexRow {
@@ -4614,7 +4638,7 @@
) { ColoredRect(model.toColor()); }
}
}
- flexible(flex = 1f) { children(); }
+ flexible(flex = 1f, children = children)
}
}
}
@@ -4711,12 +4735,12 @@
if (constraints.maxHeight > constraints.maxWidth) {
FlexColumn {
flexible(flex = 1f) { ColoredRect(model.toColor()); }
- flexible(flex = 1f) { children(); }
+ flexible(flex = 1f, children = children)
}
} else {
FlexRow {
flexible(flex = 1f) { ColoredRect(model.toColor()); }
- flexible(flex = 1f) { children(); }
+ flexible(flex = 1f, children = children)
}
}
}
@@ -4763,7 +4787,7 @@
)
}
}
- flexible(flex = 1f) { children(); }
+ flexible(flex = 1f, children = children)
}
} else {
FlexRow {
@@ -4776,7 +4800,7 @@
)
}
}
- flexible(flex = 1f) { children(); }
+ flexible(flex = 1f, children = children)
}
}
}
@@ -4851,8 +4875,9 @@
flexible(flex = 1f) {
RealWorld4_FancyWidget_082(
model = model.f4,
- s2 = "HelloWorld"
- ) { children(); }
+ s2 = "HelloWorld",
+ children = children
+ )
}
}
} else {
@@ -4872,8 +4897,9 @@
flexible(flex = 1f) {
RealWorld4_FancyWidget_082(
model = model.f4,
- s2 = "HelloWorld"
- ) { children(); }
+ s2 = "HelloWorld",
+ children = children
+ )
}
}
}
@@ -4918,7 +4944,7 @@
)
}
}
- flexible(flex = 1f) { children(); }
+ flexible(flex = 1f, children = children)
}
} else {
FlexRow {
@@ -4929,7 +4955,7 @@
)
}
}
- flexible(flex = 1f) { children(); }
+ flexible(flex = 1f, children = children)
}
}
}
@@ -4979,7 +5005,7 @@
model = model.f2
) { ColoredRect(model.toColor()); }
}
- flexible(flex = 1f) { children(); }
+ flexible(flex = 1f, children = children)
}
} else {
FlexRow {
@@ -4990,7 +5016,7 @@
model = model.f2
) { ColoredRect(model.toColor()); }
}
- flexible(flex = 1f) { children(); }
+ flexible(flex = 1f, children = children)
}
}
}
@@ -5019,12 +5045,12 @@
if (constraints.maxHeight > constraints.maxWidth) {
FlexColumn {
flexible(flex = 1f) { ColoredRect(model.toColor()); }
- flexible(flex = 1f) { children(); }
+ flexible(flex = 1f, children = children)
}
} else {
FlexRow {
flexible(flex = 1f) { ColoredRect(model.toColor()); }
- flexible(flex = 1f) { children(); }
+ flexible(flex = 1f, children = children)
}
}
}
@@ -5064,7 +5090,7 @@
)
}
}
- flexible(flex = 1f) { children(); }
+ flexible(flex = 1f, children = children)
}
} else {
FlexRow {
@@ -5080,7 +5106,7 @@
)
}
}
- flexible(flex = 1f) { children(); }
+ flexible(flex = 1f, children = children)
}
}
}
@@ -5221,7 +5247,7 @@
number = 151
)
}
- flexible(flex = 1f) { children(); }
+ flexible(flex = 1f, children = children)
}
} else {
FlexRow {
@@ -5231,7 +5257,7 @@
number = 619
)
}
- flexible(flex = 1f) { children(); }
+ flexible(flex = 1f, children = children)
}
}
}
@@ -5269,12 +5295,12 @@
if (constraints.maxHeight > constraints.maxWidth) {
FlexColumn {
flexible(flex = 1f) { ColoredRect(model.toColor()); }
- flexible(flex = 1f) { children(); }
+ flexible(flex = 1f, children = children)
}
} else {
FlexRow {
flexible(flex = 1f) { ColoredRect(model.toColor()); }
- flexible(flex = 1f) { children(); }
+ flexible(flex = 1f, children = children)
}
}
}
@@ -5356,12 +5382,12 @@
if (constraints.maxHeight > constraints.maxWidth) {
FlexColumn {
flexible(flex = 1f) { ColoredRect(model.toColor()); }
- flexible(flex = 1f) { children(); }
+ flexible(flex = 1f, children = children)
}
} else {
FlexRow {
flexible(flex = 1f) { ColoredRect(model.toColor()); }
- flexible(flex = 1f) { children(); }
+ flexible(flex = 1f, children = children)
}
}
}
@@ -5411,7 +5437,7 @@
}
}
}
- flexible(flex = 1f) { children(); }
+ flexible(flex = 1f, children = children)
}
} else {
FlexRow {
@@ -5427,7 +5453,7 @@
}
}
}
- flexible(flex = 1f) { children(); }
+ flexible(flex = 1f, children = children)
}
}
}
@@ -5542,8 +5568,9 @@
flexible(flex = 1f) {
RealWorld4_FancyWidget_014(
s1 = "HelloWorld",
- model = model.f2
- ) { children(); }
+ model = model.f2,
+ children = children
+ )
}
flexible(flex = 1f) {
RealWorld4_FancyWidget_104(
@@ -5558,8 +5585,9 @@
flexible(flex = 1f) {
RealWorld4_FancyWidget_014(
s1 = "HelloWorld",
- model = model.f2
- ) { children(); }
+ model = model.f2,
+ children = children
+ )
}
flexible(flex = 1f) {
RealWorld4_FancyWidget_104(
@@ -5596,12 +5624,12 @@
if (constraints.maxHeight > constraints.maxWidth) {
FlexColumn {
flexible(flex = 1f) { ColoredRect(model.toColor()); }
- flexible(flex = 1f) { children(); }
+ flexible(flex = 1f, children = children)
}
} else {
FlexRow {
flexible(flex = 1f) { ColoredRect(model.toColor()); }
- flexible(flex = 1f) { children(); }
+ flexible(flex = 1f, children = children)
}
}
}
@@ -5645,7 +5673,7 @@
if (constraints.maxHeight > constraints.maxWidth) {
FlexColumn {
flexible(flex = 1f) {
- RealWorld4_FancyWidget_109(model = model.f2) { children(); }
+ RealWorld4_FancyWidget_109(model = model.f2, children = children)
}
flexible(flex = 1f) {
RealWorld4_FancyWidget_108(
@@ -5657,7 +5685,7 @@
} else {
FlexRow {
flexible(flex = 1f) {
- RealWorld4_FancyWidget_109(model = model.f2) { children(); }
+ RealWorld4_FancyWidget_109(model = model.f2, children = children)
}
flexible(flex = 1f) {
RealWorld4_FancyWidget_108(
@@ -5710,8 +5738,9 @@
flexible(flex = 1f) {
RealWorld4_FancyWidget_062(
model = model.f0,
- s2 = "HelloWorld"
- ) { children(); }
+ s2 = "HelloWorld",
+ children = children
+ )
}
flexible(flex = 1f) {
RealWorld4_FancyWidget_098(
@@ -5726,8 +5755,9 @@
flexible(flex = 1f) {
RealWorld4_FancyWidget_062(
model = model.f0,
- s2 = "HelloWorld"
- ) { children(); }
+ s2 = "HelloWorld",
+ children = children
+ )
}
flexible(flex = 1f) {
RealWorld4_FancyWidget_098(
@@ -5830,12 +5860,12 @@
if (constraints.maxHeight > constraints.maxWidth) {
FlexColumn {
flexible(flex = 1f) { ColoredRect(model.toColor()); }
- flexible(flex = 1f) { children(); }
+ flexible(flex = 1f, children = children)
}
} else {
FlexRow {
flexible(flex = 1f) { ColoredRect(model.toColor()); }
- flexible(flex = 1f) { children(); }
+ flexible(flex = 1f, children = children)
}
}
}
@@ -5887,8 +5917,9 @@
flexible(flex = 1f) {
RealWorld4_FancyWidget_046(
s2 = "HelloWorld",
- model = model.f4
- ) { children(); }
+ model = model.f4,
+ children = children
+ )
}
}
} else {
@@ -5902,8 +5933,9 @@
flexible(flex = 1f) {
RealWorld4_FancyWidget_046(
s2 = "HelloWorld",
- model = model.f4
- ) { children(); }
+ model = model.f4,
+ children = children
+ )
}
}
}
@@ -5948,7 +5980,7 @@
if (constraints.maxHeight > constraints.maxWidth) {
FlexColumn {
flexible(flex = 1f) {
- RealWorld4_FancyWidget_047(model = model.f2) { children(); }
+ RealWorld4_FancyWidget_047(model = model.f2, children = children)
}
flexible(flex = 1f) {
RealWorld4_FancyWidget_102(
@@ -5961,7 +5993,7 @@
} else {
FlexRow {
flexible(flex = 1f) {
- RealWorld4_FancyWidget_047(model = model.f2) { children(); }
+ RealWorld4_FancyWidget_047(model = model.f2, children = children)
}
flexible(flex = 1f) {
RealWorld4_FancyWidget_102(
@@ -6013,12 +6045,12 @@
if (constraints.maxHeight > constraints.maxWidth) {
FlexColumn {
flexible(flex = 1f) { ColoredRect(model.toColor()); }
- flexible(flex = 1f) { children(); }
+ flexible(flex = 1f, children = children)
}
} else {
FlexRow {
flexible(flex = 1f) { ColoredRect(model.toColor()); }
- flexible(flex = 1f) { children(); }
+ flexible(flex = 1f, children = children)
}
}
}
@@ -6101,12 +6133,12 @@
if (constraints.maxHeight > constraints.maxWidth) {
FlexColumn {
flexible(flex = 1f) { ColoredRect(model.toColor()); }
- flexible(flex = 1f) { children(); }
+ flexible(flex = 1f, children = children)
}
} else {
FlexRow {
flexible(flex = 1f) { ColoredRect(model.toColor()); }
- flexible(flex = 1f) { children(); }
+ flexible(flex = 1f, children = children)
}
}
}
@@ -6147,8 +6179,9 @@
RealWorld4_FancyWidget_026(
s2 = "HelloWorld",
s1 = "HelloWorld",
- model = model.f2
- ) { children(); }
+ model = model.f2,
+ children = children
+ )
}
flexible(flex = 1f) {
RealWorld4_FancyWidget_106(model = model.f5) {
@@ -6164,8 +6197,9 @@
RealWorld4_FancyWidget_026(
s2 = "HelloWorld",
s1 = "HelloWorld",
- model = model.f2
- ) { children(); }
+ model = model.f2,
+ children = children
+ )
}
flexible(flex = 1f) {
RealWorld4_FancyWidget_106(model = model.f5) {
@@ -6202,12 +6236,12 @@
if (constraints.maxHeight > constraints.maxWidth) {
FlexColumn {
flexible(flex = 1f) { ColoredRect(model.toColor()); }
- flexible(flex = 1f) { children(); }
+ flexible(flex = 1f, children = children)
}
} else {
FlexRow {
flexible(flex = 1f) { ColoredRect(model.toColor()); }
- flexible(flex = 1f) { children(); }
+ flexible(flex = 1f, children = children)
}
}
}
@@ -6251,12 +6285,12 @@
if (constraints.maxHeight > constraints.maxWidth) {
FlexColumn {
flexible(flex = 1f) { ColoredRect(model.toColor()); }
- flexible(flex = 1f) { children(); }
+ flexible(flex = 1f, children = children)
}
} else {
FlexRow {
flexible(flex = 1f) { ColoredRect(model.toColor()); }
- flexible(flex = 1f) { children(); }
+ flexible(flex = 1f, children = children)
}
}
}
@@ -6294,12 +6328,12 @@
if (constraints.maxHeight > constraints.maxWidth) {
FlexColumn {
flexible(flex = 1f) { ColoredRect(model.toColor()); }
- flexible(flex = 1f) { children(); }
+ flexible(flex = 1f, children = children)
}
} else {
FlexRow {
flexible(flex = 1f) { ColoredRect(model.toColor()); }
- flexible(flex = 1f) { children(); }
+ flexible(flex = 1f, children = children)
}
}
}
@@ -6328,12 +6362,12 @@
if (constraints.maxHeight > constraints.maxWidth) {
FlexColumn {
flexible(flex = 1f) { ColoredRect(model.toColor()); }
- flexible(flex = 1f) { children(); }
+ flexible(flex = 1f, children = children)
}
} else {
FlexRow {
flexible(flex = 1f) { ColoredRect(model.toColor()); }
- flexible(flex = 1f) { children(); }
+ flexible(flex = 1f, children = children)
}
}
}
@@ -6383,12 +6417,12 @@
if (constraints.maxHeight > constraints.maxWidth) {
FlexColumn {
flexible(flex = 1f) { ColoredRect(model.toColor()); }
- flexible(flex = 1f) { children(); }
+ flexible(flex = 1f, children = children)
}
} else {
FlexRow {
flexible(flex = 1f) { ColoredRect(model.toColor()); }
- flexible(flex = 1f) { children(); }
+ flexible(flex = 1f, children = children)
}
}
}
@@ -6430,12 +6464,12 @@
if (constraints.maxHeight > constraints.maxWidth) {
FlexColumn {
flexible(flex = 1f) { ColoredRect(model.toColor()); }
- flexible(flex = 1f) { children(); }
+ flexible(flex = 1f, children = children)
}
} else {
FlexRow {
flexible(flex = 1f) { ColoredRect(model.toColor()); }
- flexible(flex = 1f) { children(); }
+ flexible(flex = 1f, children = children)
}
}
}
@@ -6466,8 +6500,9 @@
flexible(flex = 1f) {
RealWorld4_FancyWidget_116(
model = model.f0,
- number = 50
- ) { children(); }
+ number = 50,
+ children = children
+ )
}
flexible(flex = 1f) {
RealWorld4_FancyWidget_113(
@@ -6481,8 +6516,9 @@
flexible(flex = 1f) {
RealWorld4_FancyWidget_116(
model = model.f0,
- number = 149
- ) { children(); }
+ number = 149,
+ children = children
+ )
}
flexible(flex = 1f) {
RealWorld4_FancyWidget_113(
@@ -6538,8 +6574,9 @@
s2 = "HelloWorld",
color = Color(red = 0xFF, blue = 0x99, green = 0x11),
model = model.f5,
- s1 = "HelloWorld"
- ) { children(); }
+ s1 = "HelloWorld",
+ children = children
+ )
}
}
} else {
@@ -6556,8 +6593,9 @@
s2 = "HelloWorld",
color = Color(red = 0xFF, blue = 0x99, green = 0x11),
model = model.f5,
- s1 = "HelloWorld"
- ) { children(); }
+ s1 = "HelloWorld",
+ children = children
+ )
}
}
}
@@ -6602,12 +6640,12 @@
if (constraints.maxHeight > constraints.maxWidth) {
FlexColumn {
flexible(flex = 1f) { ColoredRect(model.toColor()); }
- flexible(flex = 1f) { children(); }
+ flexible(flex = 1f, children = children)
}
} else {
FlexRow {
flexible(flex = 1f) { ColoredRect(model.toColor()); }
- flexible(flex = 1f) { children(); }
+ flexible(flex = 1f, children = children)
}
}
}
@@ -6657,12 +6695,12 @@
if (constraints.maxHeight > constraints.maxWidth) {
FlexColumn {
flexible(flex = 1f) { ColoredRect(model.toColor()); }
- flexible(flex = 1f) { children(); }
+ flexible(flex = 1f, children = children)
}
} else {
FlexRow {
flexible(flex = 1f) { ColoredRect(model.toColor()); }
- flexible(flex = 1f) { children(); }
+ flexible(flex = 1f, children = children)
}
}
}
@@ -6705,7 +6743,7 @@
number = 355
) { ColoredRect(model.toColor()); }
}
- flexible(flex = 1f) { children(); }
+ flexible(flex = 1f, children = children)
}
} else {
FlexRow {
@@ -6715,7 +6753,7 @@
number = 514
) { ColoredRect(model.toColor()); }
}
- flexible(flex = 1f) { children(); }
+ flexible(flex = 1f, children = children)
}
}
}
@@ -6753,12 +6791,12 @@
if (constraints.maxHeight > constraints.maxWidth) {
FlexColumn {
flexible(flex = 1f) { ColoredRect(model.toColor()); }
- flexible(flex = 1f) { children(); }
+ flexible(flex = 1f, children = children)
}
} else {
FlexRow {
flexible(flex = 1f) { ColoredRect(model.toColor()); }
- flexible(flex = 1f) { children(); }
+ flexible(flex = 1f, children = children)
}
}
}
@@ -6796,12 +6834,12 @@
if (constraints.maxHeight > constraints.maxWidth) {
FlexColumn {
flexible(flex = 1f) { ColoredRect(model.toColor()); }
- flexible(flex = 1f) { children(); }
+ flexible(flex = 1f, children = children)
}
} else {
FlexRow {
flexible(flex = 1f) { ColoredRect(model.toColor()); }
- flexible(flex = 1f) { children(); }
+ flexible(flex = 1f, children = children)
}
}
}
@@ -6845,7 +6883,7 @@
)
}
}
- flexible(flex = 1f) { children(); }
+ flexible(flex = 1f, children = children)
}
} else {
FlexRow {
@@ -6856,7 +6894,7 @@
)
}
}
- flexible(flex = 1f) { children(); }
+ flexible(flex = 1f, children = children)
}
}
}
@@ -6885,12 +6923,12 @@
if (constraints.maxHeight > constraints.maxWidth) {
FlexColumn {
flexible(flex = 1f) { ColoredRect(model.toColor()); }
- flexible(flex = 1f) { children(); }
+ flexible(flex = 1f, children = children)
}
} else {
FlexRow {
flexible(flex = 1f) { ColoredRect(model.toColor()); }
- flexible(flex = 1f) { children(); }
+ flexible(flex = 1f, children = children)
}
}
}
@@ -6934,12 +6972,12 @@
if (constraints.maxHeight > constraints.maxWidth) {
FlexColumn {
flexible(flex = 1f) { ColoredRect(model.toColor()); }
- flexible(flex = 1f) { children(); }
+ flexible(flex = 1f, children = children)
}
} else {
FlexRow {
flexible(flex = 1f) { ColoredRect(model.toColor()); }
- flexible(flex = 1f) { children(); }
+ flexible(flex = 1f, children = children)
}
}
}
@@ -6993,12 +7031,12 @@
if (constraints.maxHeight > constraints.maxWidth) {
FlexColumn {
flexible(flex = 1f) { ColoredRect(model.toColor()); }
- flexible(flex = 1f) { children(); }
+ flexible(flex = 1f, children = children)
}
} else {
FlexRow {
flexible(flex = 1f) { ColoredRect(model.toColor()); }
- flexible(flex = 1f) { children(); }
+ flexible(flex = 1f, children = children)
}
}
}
@@ -7042,12 +7080,12 @@
if (constraints.maxHeight > constraints.maxWidth) {
FlexColumn {
flexible(flex = 1f) { ColoredRect(model.toColor()); }
- flexible(flex = 1f) { children(); }
+ flexible(flex = 1f, children = children)
}
} else {
FlexRow {
flexible(flex = 1f) { ColoredRect(model.toColor()); }
- flexible(flex = 1f) { children(); }
+ flexible(flex = 1f, children = children)
}
}
}
@@ -7096,7 +7134,7 @@
model = model.f2
) { ColoredRect(model.toColor()); }
}
- flexible(flex = 1f) { children(); }
+ flexible(flex = 1f, children = children)
}
} else {
FlexRow {
@@ -7106,7 +7144,7 @@
model = model.f2
) { ColoredRect(model.toColor()); }
}
- flexible(flex = 1f) { children(); }
+ flexible(flex = 1f, children = children)
}
}
}
@@ -7144,12 +7182,12 @@
if (constraints.maxHeight > constraints.maxWidth) {
FlexColumn {
flexible(flex = 1f) { ColoredRect(model.toColor()); }
- flexible(flex = 1f) { children(); }
+ flexible(flex = 1f, children = children)
}
} else {
FlexRow {
flexible(flex = 1f) { ColoredRect(model.toColor()); }
- flexible(flex = 1f) { children(); }
+ flexible(flex = 1f, children = children)
}
}
}
@@ -7187,12 +7225,12 @@
if (constraints.maxHeight > constraints.maxWidth) {
FlexColumn {
flexible(flex = 1f) { ColoredRect(model.toColor()); }
- flexible(flex = 1f) { children(); }
+ flexible(flex = 1f, children = children)
}
} else {
FlexRow {
flexible(flex = 1f) { ColoredRect(model.toColor()); }
- flexible(flex = 1f) { children(); }
+ flexible(flex = 1f, children = children)
}
}
}
@@ -7221,12 +7259,12 @@
if (constraints.maxHeight > constraints.maxWidth) {
FlexColumn {
flexible(flex = 1f) { ColoredRect(model.toColor()); }
- flexible(flex = 1f) { children(); }
+ flexible(flex = 1f, children = children)
}
} else {
FlexRow {
flexible(flex = 1f) { ColoredRect(model.toColor()); }
- flexible(flex = 1f) { children(); }
+ flexible(flex = 1f, children = children)
}
}
}
@@ -7270,12 +7308,12 @@
if (constraints.maxHeight > constraints.maxWidth) {
FlexColumn {
flexible(flex = 1f) { ColoredRect(model.toColor()); }
- flexible(flex = 1f) { children(); }
+ flexible(flex = 1f, children = children)
}
} else {
FlexRow {
flexible(flex = 1f) { ColoredRect(model.toColor()); }
- flexible(flex = 1f) { children(); }
+ flexible(flex = 1f, children = children)
}
}
}
@@ -7313,12 +7351,12 @@
if (constraints.maxHeight > constraints.maxWidth) {
FlexColumn {
flexible(flex = 1f) { ColoredRect(model.toColor()); }
- flexible(flex = 1f) { children(); }
+ flexible(flex = 1f, children = children)
}
} else {
FlexRow {
flexible(flex = 1f) { ColoredRect(model.toColor()); }
- flexible(flex = 1f) { children(); }
+ flexible(flex = 1f, children = children)
}
}
}
@@ -7347,12 +7385,12 @@
if (constraints.maxHeight > constraints.maxWidth) {
FlexColumn {
flexible(flex = 1f) { ColoredRect(model.toColor()); }
- flexible(flex = 1f) { children(); }
+ flexible(flex = 1f, children = children)
}
} else {
FlexRow {
flexible(flex = 1f) { ColoredRect(model.toColor()); }
- flexible(flex = 1f) { children(); }
+ flexible(flex = 1f, children = children)
}
}
}
@@ -7414,8 +7452,9 @@
RealWorld4_FancyWidget_068(
model = model.f2,
obj = RealWorld4_UnmemoizablePojo_2(),
- s2 = "HelloWorld"
- ) { children(); }
+ s2 = "HelloWorld",
+ children = children
+ )
}
}
} else {
@@ -7437,8 +7476,9 @@
RealWorld4_FancyWidget_068(
model = model.f2,
obj = RealWorld4_UnmemoizablePojo_2(),
- s2 = "HelloWorld"
- ) { children(); }
+ s2 = "HelloWorld",
+ children = children
+ )
}
}
}
@@ -7517,8 +7557,9 @@
) {
RealWorld4_FancyWidget_009(
model = model.f6.f11.f7.f4,
- number = 623
- ) { children(); }
+ number = 623,
+ children = children
+ )
}
}
}
@@ -7566,8 +7607,9 @@
) {
RealWorld4_FancyWidget_009(
model = model.f6.f11.f7.f4,
- number = 809
- ) { children(); }
+ number = 809,
+ children = children
+ )
}
}
}
@@ -7627,8 +7669,9 @@
RealWorld4_FancyWidget_143(
s2 = "HelloWorld",
number = 675,
- model = model.f11
- ) { children(); }
+ model = model.f11,
+ children = children
+ )
}
}
} else {
@@ -7644,8 +7687,9 @@
RealWorld4_FancyWidget_143(
s2 = "HelloWorld",
number = 903,
- model = model.f11
- ) { children(); }
+ model = model.f11,
+ children = children
+ )
}
}
}
@@ -7679,8 +7723,9 @@
RealWorld4_FancyWidget_097(
s2 = "HelloWorld",
model = model.f5,
- s1 = "HelloWorld"
- ) { children(); }
+ s1 = "HelloWorld",
+ children = children
+ )
}
flexible(flex = 1f) {
RealWorld4_FancyWidget_135(model = model.f7) {
@@ -7697,8 +7742,9 @@
RealWorld4_FancyWidget_097(
s2 = "HelloWorld",
model = model.f5,
- s1 = "HelloWorld"
- ) { children(); }
+ s1 = "HelloWorld",
+ children = children
+ )
}
flexible(flex = 1f) {
RealWorld4_FancyWidget_135(model = model.f7) {
@@ -7741,7 +7787,7 @@
model = model.f0
) { ColoredRect(model.toColor()); }
}
- flexible(flex = 1f) { children(); }
+ flexible(flex = 1f, children = children)
}
} else {
FlexRow {
@@ -7751,7 +7797,7 @@
model = model.f0
) { ColoredRect(model.toColor()); }
}
- flexible(flex = 1f) { children(); }
+ flexible(flex = 1f, children = children)
}
}
}
@@ -7798,8 +7844,9 @@
RealWorld4_FancyWidget_137(
s2 = "HelloWorld",
s1 = "HelloWorld",
- model = model.f5
- ) { children(); }
+ model = model.f5,
+ children = children
+ )
}
}
} else {
@@ -7814,8 +7861,9 @@
RealWorld4_FancyWidget_137(
s2 = "HelloWorld",
s1 = "HelloWorld",
- model = model.f5
- ) { children(); }
+ model = model.f5,
+ children = children
+ )
}
}
}
@@ -7860,12 +7908,12 @@
if (constraints.maxHeight > constraints.maxWidth) {
FlexColumn {
flexible(flex = 1f) { ColoredRect(model.toColor()); }
- flexible(flex = 1f) { children(); }
+ flexible(flex = 1f, children = children)
}
} else {
FlexRow {
flexible(flex = 1f) { ColoredRect(model.toColor()); }
- flexible(flex = 1f) { children(); }
+ flexible(flex = 1f, children = children)
}
}
}
@@ -7894,12 +7942,12 @@
if (constraints.maxHeight > constraints.maxWidth) {
FlexColumn {
flexible(flex = 1f) { ColoredRect(model.toColor()); }
- flexible(flex = 1f) { children(); }
+ flexible(flex = 1f, children = children)
}
} else {
FlexRow {
flexible(flex = 1f) { ColoredRect(model.toColor()); }
- flexible(flex = 1f) { children(); }
+ flexible(flex = 1f, children = children)
}
}
}
@@ -7940,7 +7988,7 @@
)
}
}
- flexible(flex = 1f) { children(); }
+ flexible(flex = 1f, children = children)
}
} else {
FlexRow {
@@ -7956,7 +8004,7 @@
)
}
}
- flexible(flex = 1f) { children(); }
+ flexible(flex = 1f, children = children)
}
}
}
@@ -8011,8 +8059,9 @@
b = false,
obj = RealWorld4_UnmemoizablePojo_7(),
model = model.f11.f7,
- s1 = "HelloWorld"
- ) { children(); }
+ s1 = "HelloWorld",
+ children = children
+ )
}
}
}
@@ -8034,8 +8083,9 @@
b = false,
obj = RealWorld4_UnmemoizablePojo_7(),
model = model.f11.f7,
- s1 = "HelloWorld"
- ) { children(); }
+ s1 = "HelloWorld",
+ children = children
+ )
}
}
}
@@ -8082,7 +8132,7 @@
model = model.f10
) { RealWorld4_FancyWidget_093(s1 = "HelloWorld", model = model.f10.f7); }
}
- flexible(flex = 1f) { children(); }
+ flexible(flex = 1f, children = children)
}
} else {
FlexRow {
@@ -8092,7 +8142,7 @@
model = model.f10
) { RealWorld4_FancyWidget_093(s1 = "HelloWorld", model = model.f10.f7); }
}
- flexible(flex = 1f) { children(); }
+ flexible(flex = 1f, children = children)
}
}
}
@@ -8242,8 +8292,9 @@
RealWorld4_FancyWidget_039(
model = model.f7,
s1 = "HelloWorld",
- b = false
- ) { children(); }
+ b = false,
+ children = children
+ )
}
}
} else {
@@ -8267,8 +8318,9 @@
RealWorld4_FancyWidget_039(
model = model.f7,
s1 = "HelloWorld",
- b = false
- ) { children(); }
+ b = false,
+ children = children
+ )
}
}
}
@@ -8333,7 +8385,7 @@
b = false
)
}
- flexible(flex = 1f) { children(); }
+ flexible(flex = 1f, children = children)
}
} else {
FlexRow {
@@ -8346,7 +8398,7 @@
b = true
)
}
- flexible(flex = 1f) { children(); }
+ flexible(flex = 1f, children = children)
}
}
}
@@ -8407,8 +8459,9 @@
number = 626,
obj = RealWorld4_UnmemoizablePojo_12(),
b = false,
- model = model.f5
- ) { children(); }
+ model = model.f5,
+ children = children
+ )
}
}
} else {
@@ -8425,8 +8478,9 @@
number = 417,
obj = RealWorld4_UnmemoizablePojo_12(),
b = false,
- model = model.f5
- ) { children(); }
+ model = model.f5,
+ children = children
+ )
}
}
}
@@ -8486,8 +8540,9 @@
RealWorld4_FancyWidget_034(
model = model.f2,
b = false,
- s2 = "HelloWorld"
- ) { children(); }
+ s2 = "HelloWorld",
+ children = children
+ )
}
flexible(flex = 1f) {
RealWorld4_FancyWidget_129(
@@ -8502,8 +8557,9 @@
RealWorld4_FancyWidget_034(
model = model.f2,
b = true,
- s2 = "HelloWorld"
- ) { children(); }
+ s2 = "HelloWorld",
+ children = children
+ )
}
flexible(flex = 1f) {
RealWorld4_FancyWidget_129(
@@ -8570,12 +8626,12 @@
if (constraints.maxHeight > constraints.maxWidth) {
FlexColumn {
flexible(flex = 1f) { ColoredRect(model.toColor()); }
- flexible(flex = 1f) { children(); }
+ flexible(flex = 1f, children = children)
}
} else {
FlexRow {
flexible(flex = 1f) { ColoredRect(model.toColor()); }
- flexible(flex = 1f) { children(); }
+ flexible(flex = 1f, children = children)
}
}
}
@@ -8677,7 +8733,7 @@
color = Color(red = 0xFF, blue = 0x99, green = 0x11)
)
}
- flexible(flex = 1f) { children(); }
+ flexible(flex = 1f, children = children)
}
} else {
FlexRow {
@@ -8687,7 +8743,7 @@
color = Color(red = 0xFF, blue = 0x99, green = 0x11)
)
}
- flexible(flex = 1f) { children(); }
+ flexible(flex = 1f, children = children)
}
}
}
diff --git a/compose/compose-runtime/compose-runtime-benchmark/src/androidTest/java/androidx/compose/benchmark/siblings/SiblingManagement.kt b/compose/compose-runtime/compose-runtime-benchmark/src/androidTest/java/androidx/compose/benchmark/siblings/SiblingManagement.kt
index 3315bbb..b333cb0 100644
--- a/compose/compose-runtime/compose-runtime-benchmark/src/androidTest/java/androidx/compose/benchmark/siblings/SiblingManagement.kt
+++ b/compose/compose-runtime/compose-runtime-benchmark/src/androidTest/java/androidx/compose/benchmark/siblings/SiblingManagement.kt
@@ -31,13 +31,6 @@
import kotlin.random.Random
@Composable
-fun Stack(children: @Composable() () -> Unit) {
- Column(ExpandedHeight) {
- children()
- }
-}
-
-@Composable
fun PivotalItemRow(@Pivotal item: Item) {
val color = when (item.id % 3) {
0 -> Color.Blue
@@ -109,7 +102,7 @@
@Composable
fun SiblingManagement(identity: IdentityType, items: List<Item>) {
- Stack {
+ Column(ExpandedHeight) {
when (identity) {
IdentityType.Pivotal -> {
for (item in items) {
diff --git a/compose/compose-runtime/integration-tests/samples/src/main/java/androidx/compose/samples/PivotalSamples.kt b/compose/compose-runtime/integration-tests/samples/src/main/java/androidx/compose/samples/PivotalSamples.kt
index 5421562..162bc3d 100644
--- a/compose/compose-runtime/integration-tests/samples/src/main/java/androidx/compose/samples/PivotalSamples.kt
+++ b/compose/compose-runtime/integration-tests/samples/src/main/java/androidx/compose/samples/PivotalSamples.kt
@@ -43,7 +43,7 @@
var user by +state<User?> { null }
+onActive {
val dispose = Api.getUserAsync(userId) { user = it }
- onDispose { dispose() }
+ onDispose(dispose)
}
if (user == null) {
@@ -63,7 +63,7 @@
var user by +state<User?> { null }
+onCommit(userId) {
val dispose = Api.getUserAsync(userId) { user = it }
- onDispose { dispose() }
+ onDispose(dispose)
}
if (user == null) {
@@ -83,7 +83,7 @@
var user by +state<User?> { null }
+onActive {
val dispose = Api.getUserAsync(userId) { user = it }
- onDispose { dispose() }
+ onDispose(dispose)
}
if (user == null) {
diff --git a/ui/settings.gradle b/ui/settings.gradle
index 9cd7438..3a37022 100644
--- a/ui/settings.gradle
+++ b/ui/settings.gradle
@@ -51,6 +51,7 @@
includeProject(":ui:ui-framework", "ui-framework")
includeProject(":ui:ui-framework:integration-tests:ui-framework-demos", "ui-framework/integration-tests/framework-demos")
includeProject(":ui:ui-framework:integration-tests:samples", "ui-framework/integration-tests/samples")
+includeProject(":ui:ui-internal-lint-checks", "ui-internal-lint-checks")
includeProject(":ui:ui-layout", "ui-layout")
includeProject(":ui:ui-layout:integration-tests:samples", "ui-layout/integration-tests/samples")
includeProject(":ui:ui-layout:integration-tests:ui-layout-demos", "ui-layout/integration-tests/layout-demos")
diff --git a/ui/ui-android-view-non-ir/src/main/java/androidx/ui/androidview/adapters/ViewAttributeAdapter.kt b/ui/ui-android-view-non-ir/src/main/java/androidx/ui/androidview/adapters/ViewAttributeAdapter.kt
index 99619cc..8f671fd 100644
--- a/ui/ui-android-view-non-ir/src/main/java/androidx/ui/androidview/adapters/ViewAttributeAdapter.kt
+++ b/ui/ui-android-view-non-ir/src/main/java/androidx/ui/androidview/adapters/ViewAttributeAdapter.kt
@@ -18,6 +18,7 @@
package androidx.ui.androidview.adapters
+import android.annotation.SuppressLint
import androidx.annotation.DimenRes
import android.view.View
import androidx.ui.androidview.annotations.ConflictsWith
@@ -145,6 +146,7 @@
fun View.setScrollY(scrollY: Dimension) = setScrollY(scrollY.toIntPixels(metrics))
fun View.setTop(top: Dimension) = setTop(top.toIntPixels(metrics))
+@SuppressLint("UnnecessaryLambdaCreation")
// TODO: Necessary because the IR doesn't support SAM conversion yet
fun View.setOnClick(lambda: () -> Unit) { this.setOnClickListener { lambda() } }
diff --git a/ui/ui-foundation/src/main/java/androidx/ui/foundation/Clickable.kt b/ui/ui-foundation/src/main/java/androidx/ui/foundation/Clickable.kt
index be859dc..916fbe8 100644
--- a/ui/ui-foundation/src/main/java/androidx/ui/foundation/Clickable.kt
+++ b/ui/ui-foundation/src/main/java/androidx/ui/foundation/Clickable.kt
@@ -50,9 +50,8 @@
) {
PressReleasedGestureDetector(
>
- consumeDownOnStart = consumeDownOnStart
- ) {
- children()
- }
+ consumeDownOnStart = consumeDownOnStart,
+ children = children
+ )
}
}
\ No newline at end of file
diff --git a/ui/ui-foundation/src/main/java/androidx/ui/foundation/DeterminateProgressIndicator.kt b/ui/ui-foundation/src/main/java/androidx/ui/foundation/DeterminateProgressIndicator.kt
index 7423380..21113d1 100644
--- a/ui/ui-foundation/src/main/java/androidx/ui/foundation/DeterminateProgressIndicator.kt
+++ b/ui/ui-foundation/src/main/java/androidx/ui/foundation/DeterminateProgressIndicator.kt
@@ -40,7 +40,5 @@
if (progress !in 0f..1f) {
throw IllegalArgumentException("Progress must be between 0.0 and 1.0")
}
- Semantics(properties = { accessibilityValue = "$progress" }) {
- children()
- }
+ Semantics(properties = { accessibilityValue = "$progress" }, children = children)
}
diff --git a/ui/ui-foundation/src/main/java/androidx/ui/foundation/Popup.kt b/ui/ui-foundation/src/main/java/androidx/ui/foundation/Popup.kt
index 7e20c77..f26daf0 100644
--- a/ui/ui-foundation/src/main/java/androidx/ui/foundation/Popup.kt
+++ b/ui/ui-foundation/src/main/java/androidx/ui/foundation/Popup.kt
@@ -168,9 +168,7 @@
// Update the popup's position
popupLayout.updatePosition()
- }) {
- children()
- }
+ }, children)
}
}
diff --git a/ui/ui-foundation/src/main/java/androidx/ui/foundation/Scroller.kt b/ui/ui-foundation/src/main/java/androidx/ui/foundation/Scroller.kt
index 91be983..1e55e3a 100644
--- a/ui/ui-foundation/src/main/java/androidx/ui/foundation/Scroller.kt
+++ b/ui/ui-foundation/src/main/java/androidx/ui/foundation/Scroller.kt
@@ -228,9 +228,7 @@
Layout(children = {
Clip(RectangleShape) {
Container {
- RepaintBoundary {
- child()
- }
+ RepaintBoundary(children = child)
}
}
}) { measurables, constraints ->
diff --git a/ui/ui-foundation/src/main/java/androidx/ui/foundation/selection/MutuallyExclusiveSetItem.kt b/ui/ui-foundation/src/main/java/androidx/ui/foundation/selection/MutuallyExclusiveSetItem.kt
index 8e8bf36..1215903 100644
--- a/ui/ui-foundation/src/main/java/androidx/ui/foundation/selection/MutuallyExclusiveSetItem.kt
+++ b/ui/ui-foundation/src/main/java/androidx/ui/foundation/selection/MutuallyExclusiveSetItem.kt
@@ -51,9 +51,8 @@
}) {
PressReleasedGestureDetector(
>
- consumeDownOnStart = false
- ) {
- children()
- }
+ consumeDownOnStart = false,
+ children = children
+ )
}
}
\ No newline at end of file
diff --git a/ui/ui-foundation/src/main/java/androidx/ui/foundation/selection/Toggleable.kt b/ui/ui-foundation/src/main/java/androidx/ui/foundation/selection/Toggleable.kt
index 3b87da0..2ceb337 100644
--- a/ui/ui-foundation/src/main/java/androidx/ui/foundation/selection/Toggleable.kt
+++ b/ui/ui-foundation/src/main/java/androidx/ui/foundation/selection/Toggleable.kt
@@ -91,9 +91,7 @@
if (onToggle != null) {
onClick(action = onToggle, label = "Toggle")
}
- }) {
- children()
- }
+ }, children = children)
}
}
diff --git a/ui/ui-framework/integration-tests/framework-demos/src/main/java/androidx/ui/framework/demos/SemanticsL1.kt b/ui/ui-framework/integration-tests/framework-demos/src/main/java/androidx/ui/framework/demos/SemanticsL1.kt
index c35bd99..49d2137 100644
--- a/ui/ui-framework/integration-tests/framework-demos/src/main/java/androidx/ui/framework/demos/SemanticsL1.kt
+++ b/ui/ui-framework/integration-tests/framework-demos/src/main/java/androidx/ui/framework/demos/SemanticsL1.kt
@@ -149,9 +149,8 @@
PressGestureDetector(
onPress.action(ActionParam(ActionCaller.PointerInput, it)) },
onRelease.action(ActionParam(ActionCaller.PointerInput, Unit)) },
- onCancel.action(ActionParam(ActionCaller.PointerInput, Unit)) }) {
- children()
- }
+ onCancel.action(ActionParam(ActionCaller.PointerInput, Unit)) },
+ children = children)
}
/**
@@ -181,9 +180,7 @@
mainAxisAlignment = MainAxisAlignment.Center,
crossAxisAlignment = CrossAxisAlignment.Center
) {
- Container(height = 300.dp, width = 500.dp) {
- children()
- }
+ Container(height = 300.dp, width = 500.dp, children = children)
}
}
}
diff --git a/ui/ui-framework/integration-tests/framework-demos/src/main/java/androidx/ui/framework/demos/SemanticsL2.kt b/ui/ui-framework/integration-tests/framework-demos/src/main/java/androidx/ui/framework/demos/SemanticsL2.kt
index d193f5b..0e56ffb 100644
--- a/ui/ui-framework/integration-tests/framework-demos/src/main/java/androidx/ui/framework/demos/SemanticsL2.kt
+++ b/ui/ui-framework/integration-tests/framework-demos/src/main/java/androidx/ui/framework/demos/SemanticsL2.kt
@@ -38,7 +38,7 @@
propertySet.add(visibility)
}
- Semantics(properties = propertySet, actions = actions) { children() }
+ Semantics(properties = propertySet, actions = actions, children = children)
}
/**
diff --git a/ui/ui-framework/integration-tests/framework-demos/src/main/java/androidx/ui/framework/demos/SemanticsL3.kt b/ui/ui-framework/integration-tests/framework-demos/src/main/java/androidx/ui/framework/demos/SemanticsL3.kt
index 768fe0a0..95a80db 100644
--- a/ui/ui-framework/integration-tests/framework-demos/src/main/java/androidx/ui/framework/demos/SemanticsL3.kt
+++ b/ui/ui-framework/integration-tests/framework-demos/src/main/java/androidx/ui/framework/demos/SemanticsL3.kt
@@ -38,7 +38,7 @@
}.build()
Semantics(actions = setOf(clickAction)) {
- PressGestureDetectorWithActions( { children() }
+ PressGestureDetectorWithActions( children = children)
}
}
diff --git a/ui/ui-framework/integration-tests/framework-demos/src/main/java/androidx/ui/framework/demos/gestures/NestedPressDemo.kt b/ui/ui-framework/integration-tests/framework-demos/src/main/java/androidx/ui/framework/demos/gestures/NestedPressDemo.kt
index 6cb7ecf..d3283c2 100644
--- a/ui/ui-framework/integration-tests/framework-demos/src/main/java/androidx/ui/framework/demos/gestures/NestedPressDemo.kt
+++ b/ui/ui-framework/integration-tests/framework-demos/src/main/java/androidx/ui/framework/demos/gestures/NestedPressDemo.kt
@@ -115,9 +115,7 @@
(-1).dp,
color
)
- Padding(paddingLeft, paddingTop, paddingRight, paddingBottom) {
- children()
- }
+ Padding(paddingLeft, paddingTop, paddingRight, paddingBottom, children)
}
}
}
diff --git a/ui/ui-framework/integration-tests/framework-demos/src/main/java/androidx/ui/framework/demos/gestures/SimpleComposables.kt b/ui/ui-framework/integration-tests/framework-demos/src/main/java/androidx/ui/framework/demos/gestures/SimpleComposables.kt
index d5867ac..9f34f09 100644
--- a/ui/ui-framework/integration-tests/framework-demos/src/main/java/androidx/ui/framework/demos/gestures/SimpleComposables.kt
+++ b/ui/ui-framework/integration-tests/framework-demos/src/main/java/androidx/ui/framework/demos/gestures/SimpleComposables.kt
@@ -152,10 +152,9 @@
Padding(padding) {
Border(
color = borderColor,
- width = borderWidth
- ) {
- children()
- }
+ width = borderWidth,
+ children = children
+ )
}
}) { measurables, constraints ->
val newConstraints =
diff --git a/ui/ui-framework/src/androidTest/java/androidx/ui/core/gesture/LongPressDragGestureDetectorTest.kt b/ui/ui-framework/src/androidTest/java/androidx/ui/core/gesture/LongPressDragGestureDetectorTest.kt
index c6b5854..43206f3 100644
--- a/ui/ui-framework/src/androidTest/java/androidx/ui/core/gesture/LongPressDragGestureDetectorTest.kt
+++ b/ui/ui-framework/src/androidTest/java/androidx/ui/core/gesture/LongPressDragGestureDetectorTest.kt
@@ -253,9 +253,7 @@
private fun waitForLongPress(block: () -> Unit) {
longPressCountDownLatch = CountDownLatch(1)
- activityTestRule.runOnUiThreadIR {
- block()
- }
+ activityTestRule.runOnUiThreadIR(block)
assertTrue(longPressCountDownLatch.await(750, TimeUnit.MILLISECONDS))
}
}
diff --git a/ui/ui-framework/src/androidTest/java/androidx/ui/core/test/AndroidLayoutDrawTest.kt b/ui/ui-framework/src/androidTest/java/androidx/ui/core/test/AndroidLayoutDrawTest.kt
index 63cce8f..05c767a 100644
--- a/ui/ui-framework/src/androidTest/java/androidx/ui/core/test/AndroidLayoutDrawTest.kt
+++ b/ui/ui-framework/src/androidTest/java/androidx/ui/core/test/AndroidLayoutDrawTest.kt
@@ -552,9 +552,7 @@
setContentView(root)
Compose.composeInto(root.root, context = this) {
ContextAmbient.Provider(value = this) {
- DensityAmbient.Provider(value = Density(this)) {
- composable()
- }
+ DensityAmbient.Provider(value = Density(this), children = composable)
}
}
}
diff --git a/ui/ui-framework/src/main/java/androidx/ui/core/Text.kt b/ui/ui-framework/src/main/java/androidx/ui/core/Text.kt
index 201642c..e09787a 100644
--- a/ui/ui-framework/src/main/java/androidx/ui/core/Text.kt
+++ b/ui/ui-framework/src/main/java/androidx/ui/core/Text.kt
@@ -303,9 +303,7 @@
fun CurrentTextStyleProvider(value: TextStyle, children: @Composable() () -> Unit) {
val style = +ambient(CurrentTextStyleAmbient)
val mergedStyle = style.merge(value)
- CurrentTextStyleAmbient.Provider(value = mergedStyle) {
- children()
- }
+ CurrentTextStyleAmbient.Provider(value = mergedStyle, children = children)
}
/**
diff --git a/ui/ui-framework/src/main/java/androidx/ui/core/TextField.kt b/ui/ui-framework/src/main/java/androidx/ui/core/TextField.kt
index 12030d6..c3650a7 100644
--- a/ui/ui-framework/src/main/java/androidx/ui/core/TextField.kt
+++ b/ui/ui-framework/src/main/java/androidx/ui/core/TextField.kt
@@ -523,10 +523,9 @@
doFocusIn()
}
},
- >
- ) {
- children()
- }
+ >
+ children = children
+ )
}
}
@@ -588,9 +587,6 @@
tracker.value.onDrag(dragDistance)
return tracker.value.getPosition()
}
- }
- ) {
- children()
- }
+ }, children = children)
}
}
diff --git a/ui/ui-framework/src/main/java/androidx/ui/core/Wrapper.kt b/ui/ui-framework/src/main/java/androidx/ui/core/Wrapper.kt
index d3c5bbe..fe2affe 100644
--- a/ui/ui-framework/src/main/java/androidx/ui/core/Wrapper.kt
+++ b/ui/ui-framework/src/main/java/androidx/ui/core/Wrapper.kt
@@ -91,9 +91,7 @@
val coroutineContext = Dispatchers.Main
cc =
Compose.composeInto(container = rootLayoutNode, context = context, parent = reference) {
- WrapWithAmbients(rootRef.value!!, context, coroutineContext) {
- children()
- }
+ WrapWithAmbients(rootRef.value!!, context, coroutineContext, children)
}
}
}
@@ -116,9 +114,7 @@
// kotlinx.coroutines.Dispatchers' not instance of 'Precise Reference: androidx.compose.Ambient'.
val coroutineContext = Dispatchers.Main
return Compose.composeInto(composeView.root, this) {
- WrapWithAmbients(composeView, this, coroutineContext) {
- content()
- }
+ WrapWithAmbients(composeView, this, coroutineContext, content)
}
}
@@ -138,9 +134,7 @@
// kotlinx.coroutines.Dispatchers' not instance of 'Precise Reference: androidx.compose.Ambient'.
val coroutineContext = Dispatchers.Main
return Compose.composeInto(composeView.root, context) {
- WrapWithAmbients(composeView, context, coroutineContext) {
- content()
- }
+ WrapWithAmbients(composeView, context, coroutineContext, content)
}
}
diff --git a/ui/ui-framework/src/main/java/androidx/ui/core/gesture/DoubleTapGestureDetector.kt b/ui/ui-framework/src/main/java/androidx/ui/core/gesture/DoubleTapGestureDetector.kt
index eff9391..b4f8ac1 100644
--- a/ui/ui-framework/src/main/java/androidx/ui/core/gesture/DoubleTapGestureDetector.kt
+++ b/ui/ui-framework/src/main/java/androidx/ui/core/gesture/DoubleTapGestureDetector.kt
@@ -60,9 +60,7 @@
+memo { DoubleTapGestureRecognizer(coroutineContext) }
recognizer.>
- PointerInputWrapper(pointerInputHandler = recognizer.pointerInputHandler) {
- children()
- }
+ PointerInputWrapper(pointerInputHandler = recognizer.pointerInputHandler, children = children)
}
internal class DoubleTapGestureRecognizer(
diff --git a/ui/ui-framework/src/main/java/androidx/ui/core/gesture/LongPressDragGestureDetector.kt b/ui/ui-framework/src/main/java/androidx/ui/core/gesture/LongPressDragGestureDetector.kt
index c06ee44..0aea070 100644
--- a/ui/ui-framework/src/main/java/androidx/ui/core/gesture/LongPressDragGestureDetector.kt
+++ b/ui/ui-framework/src/main/java/androidx/ui/core/gesture/LongPressDragGestureDetector.kt
@@ -112,9 +112,7 @@
RawDragGestureDetector(glue.dragObserver, glue::dragEnabled) {
PointerInputWrapper(glue.pointerInputHandler) {
- LongPressGestureDetector(glue.onLongPress) {
- children()
- }
+ LongPressGestureDetector(glue.onLongPress, children)
}
}
}
diff --git a/ui/ui-framework/src/main/java/androidx/ui/core/gesture/LongPressGestureDetector.kt b/ui/ui-framework/src/main/java/androidx/ui/core/gesture/LongPressGestureDetector.kt
index 978681f..45935f4 100644
--- a/ui/ui-framework/src/main/java/androidx/ui/core/gesture/LongPressGestureDetector.kt
+++ b/ui/ui-framework/src/main/java/androidx/ui/core/gesture/LongPressGestureDetector.kt
@@ -56,9 +56,7 @@
+memo { LongPressGestureRecognizer(coroutineContext) }
recognizer.>
- PointerInputWrapper(pointerInputHandler = recognizer.pointerInputHandler) {
- children()
- }
+ PointerInputWrapper(pointerInputHandler = recognizer.pointerInputHandler, children = children)
}
internal class LongPressGestureRecognizer(
diff --git a/ui/ui-framework/src/main/java/androidx/ui/core/gesture/PressGestureDetector.kt b/ui/ui-framework/src/main/java/androidx/ui/core/gesture/PressGestureDetector.kt
index 080ddae..494e1be 100644
--- a/ui/ui-framework/src/main/java/androidx/ui/core/gesture/PressGestureDetector.kt
+++ b/ui/ui-framework/src/main/java/androidx/ui/core/gesture/PressGestureDetector.kt
@@ -27,8 +27,10 @@
children: @Composable() () -> Unit
) {
PressIndicatorGestureDetector( {
- PressReleasedGestureDetector( consumeDownOnStart = false) {
- children()
- }
+ PressReleasedGestureDetector(
+ >
+ consumeDownOnStart = false,
+ children = children
+ )
}
}
\ No newline at end of file
diff --git a/ui/ui-framework/src/main/java/androidx/ui/core/gesture/PressIndicatorGestureDetector.kt b/ui/ui-framework/src/main/java/androidx/ui/core/gesture/PressIndicatorGestureDetector.kt
index 54536ec..53ea90a 100644
--- a/ui/ui-framework/src/main/java/androidx/ui/core/gesture/PressIndicatorGestureDetector.kt
+++ b/ui/ui-framework/src/main/java/androidx/ui/core/gesture/PressIndicatorGestureDetector.kt
@@ -60,9 +60,7 @@
recognizer.>
recognizer.>
- PointerInputWrapper(pointerInputHandler = recognizer.pointerInputHandler) {
- children()
- }
+ PointerInputWrapper(pointerInputHandler = recognizer.pointerInputHandler, children = children)
}
internal class PressIndicatorGestureRecognizer {
diff --git a/ui/ui-framework/src/main/java/androidx/ui/core/gesture/PressReleasedGestureDetector.kt b/ui/ui-framework/src/main/java/androidx/ui/core/gesture/PressReleasedGestureDetector.kt
index af1808a..85d1c5b 100644
--- a/ui/ui-framework/src/main/java/androidx/ui/core/gesture/PressReleasedGestureDetector.kt
+++ b/ui/ui-framework/src/main/java/androidx/ui/core/gesture/PressReleasedGestureDetector.kt
@@ -58,9 +58,7 @@
recognizer.>
recognizer.consumeDownOnStart = consumeDownOnStart
- PointerInputWrapper(pointerInputHandler = recognizer.pointerInputHandler) {
- children()
- }
+ PointerInputWrapper(pointerInputHandler = recognizer.pointerInputHandler, children = children)
}
internal class PressReleaseGestureRecognizer {
diff --git a/ui/ui-framework/src/main/java/androidx/ui/core/gesture/RawDragGestureDetector.kt b/ui/ui-framework/src/main/java/androidx/ui/core/gesture/RawDragGestureDetector.kt
index adb7732..bd30cc4 100644
--- a/ui/ui-framework/src/main/java/androidx/ui/core/gesture/RawDragGestureDetector.kt
+++ b/ui/ui-framework/src/main/java/androidx/ui/core/gesture/RawDragGestureDetector.kt
@@ -121,9 +121,7 @@
recognizer.dragObserver = dragObserver
recognizer.canStartDragging = canStartDragging
- PointerInputWrapper(pointerInputHandler = recognizer.pointerInputHandler) {
- children()
- }
+ PointerInputWrapper(pointerInputHandler = recognizer.pointerInputHandler, children = children)
}
internal class RawDragGestureRecognizer {
diff --git a/ui/ui-framework/src/main/java/androidx/ui/core/gesture/TouchSlopDragGestureDetector.kt b/ui/ui-framework/src/main/java/androidx/ui/core/gesture/TouchSlopDragGestureDetector.kt
index 636c602..277aa36 100644
--- a/ui/ui-framework/src/main/java/androidx/ui/core/gesture/TouchSlopDragGestureDetector.kt
+++ b/ui/ui-framework/src/main/java/androidx/ui/core/gesture/TouchSlopDragGestureDetector.kt
@@ -52,9 +52,7 @@
glue.touchSlopDragObserver = dragObserver
RawDragGestureDetector(glue.rawDragObserver, glue::dragEnabled) {
- TouchSlopExceededGestureDetector(glue::enableDrag, canDrag) {
- children()
- }
+ TouchSlopExceededGestureDetector(glue::enableDrag, canDrag, children)
}
}
diff --git a/ui/ui-framework/src/main/java/androidx/ui/core/gesture/TouchSlopExceededGestureDetector.kt b/ui/ui-framework/src/main/java/androidx/ui/core/gesture/TouchSlopExceededGestureDetector.kt
index 3f032c3..c22b449 100644
--- a/ui/ui-framework/src/main/java/androidx/ui/core/gesture/TouchSlopExceededGestureDetector.kt
+++ b/ui/ui-framework/src/main/java/androidx/ui/core/gesture/TouchSlopExceededGestureDetector.kt
@@ -55,9 +55,7 @@
recognizer.canDrag = canDrag
recognizer.>
- PointerInputWrapper(pointerInputHandler = recognizer.pointerInputHandler) {
- children()
- }
+ PointerInputWrapper(pointerInputHandler = recognizer.pointerInputHandler, children = children)
}
internal class TouchSlopExceededGestureRecognizer(private val touchSlop: IntPx) {
diff --git a/ui/ui-framework/src/main/java/androidx/ui/semantics/Semantics.kt b/ui/ui-framework/src/main/java/androidx/ui/semantics/Semantics.kt
index 66d8a4e..c03c28d 100644
--- a/ui/ui-framework/src/main/java/androidx/ui/semantics/Semantics.kt
+++ b/ui/ui-framework/src/main/java/androidx/ui/semantics/Semantics.kt
@@ -67,8 +67,6 @@
explicitChildNodes = explicitChildNodes,
semanticsConfiguration = semanticsConfiguration
) {
- TestTag(tag = DefaultTestTag) {
- children()
- }
+ TestTag(tag = DefaultTestTag, children = children)
}
}
diff --git a/ui/ui-internal-lint-checks/build.gradle b/ui/ui-internal-lint-checks/build.gradle
new file mode 100644
index 0000000..2600c66
--- /dev/null
+++ b/ui/ui-internal-lint-checks/build.gradle
@@ -0,0 +1,45 @@
+import androidx.build.LibraryGroups
+import androidx.build.LibraryVersions
+import androidx.build.Publish
+
+/*
+ * Copyright 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import static androidx.build.dependencies.DependenciesKt.*
+
+plugins {
+ id("AndroidXPlugin")
+ id("kotlin")
+}
+
+dependencies {
+ compileOnly LINT_API_LATEST
+ compileOnly KOTLIN_STDLIB
+
+ testImplementation KOTLIN_STDLIB
+ testImplementation LINT_CORE
+ testImplementation LINT_TESTS
+}
+
+androidx {
+ name = "UI lint checks"
+ publish = Publish.NONE
+ toolingProject = true
+ mavenVersion = LibraryVersions.UI
+ mavenGroup = LibraryGroups.UI
+ inceptionYear = "2019"
+ description = "Internal lint checks for Compose"
+}
diff --git a/ui/ui-internal-lint-checks/src/main/java/androidx/ui/lint/ComposeIssueRegistry.kt b/ui/ui-internal-lint-checks/src/main/java/androidx/ui/lint/ComposeIssueRegistry.kt
new file mode 100644
index 0000000..4798beb
--- /dev/null
+++ b/ui/ui-internal-lint-checks/src/main/java/androidx/ui/lint/ComposeIssueRegistry.kt
@@ -0,0 +1,25 @@
+/*
+ * Copyright 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package androidx.ui.lint
+
+import com.android.tools.lint.client.api.IssueRegistry
+import com.android.tools.lint.detector.api.CURRENT_API
+
+class ComposeIssueRegistry : IssueRegistry() {
+ override val api = CURRENT_API
+ override val issues get() = listOf(UnnecessaryLambdaCreationDetector.ISSUE)
+}
diff --git a/ui/ui-internal-lint-checks/src/main/java/androidx/ui/lint/UnnecessaryLambdaCreationDetector.kt b/ui/ui-internal-lint-checks/src/main/java/androidx/ui/lint/UnnecessaryLambdaCreationDetector.kt
new file mode 100644
index 0000000..6bf8391
--- /dev/null
+++ b/ui/ui-internal-lint-checks/src/main/java/androidx/ui/lint/UnnecessaryLambdaCreationDetector.kt
@@ -0,0 +1,137 @@
+/*
+ * Copyright 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package androidx.ui.lint
+
+import com.android.tools.lint.client.api.UElementHandler
+import com.android.tools.lint.detector.api.Category
+import com.android.tools.lint.detector.api.Detector
+import com.android.tools.lint.detector.api.Implementation
+import com.android.tools.lint.detector.api.Issue
+import com.android.tools.lint.detector.api.JavaContext
+import com.android.tools.lint.detector.api.Scope
+import com.android.tools.lint.detector.api.Severity
+import com.android.tools.lint.detector.api.SourceCodeScanner
+import com.intellij.psi.impl.source.PsiClassReferenceType
+import org.jetbrains.kotlin.psi.KtCallExpression
+import org.jetbrains.kotlin.psi.psiUtil.referenceExpression
+import org.jetbrains.uast.ULambdaExpression
+import org.jetbrains.uast.kotlin.KotlinUBlockExpression
+import org.jetbrains.uast.kotlin.KotlinUFunctionCallExpression
+import org.jetbrains.uast.kotlin.KotlinUImplicitReturnExpression
+
+/**
+ * Lint [Detector] to ensure that we are not creating extra lambdas just to emit already captured
+ * lambdas inside Compose code. For example:
+ * ```
+ * val lambda = @Composable {}
+ * Foo {
+ * lambda()
+ * }
+ * ```
+ *
+ * Can just be inlined to:
+ * ```
+ * Foo(lambda)
+ * ```
+ *
+ * This helps avoid object allocation but more importantly helps us avoid extra code generation
+ * around composable lambdas.
+ */
+class UnnecessaryLambdaCreationDetector : Detector(), SourceCodeScanner {
+ override fun createUastHandler(context: JavaContext) = UnnecessaryLambdaCreationHandler(context)
+
+ override fun getApplicableUastTypes() = listOf(ULambdaExpression::class.java)
+
+ /**
+ * This handler visits every lambda expression and reports an issue if the following criteria
+ * (in order) hold true:
+ *
+ * 1. There is only one expression inside the lambda.
+ * 2. The expression is a function call
+ * 3. The lambda is being invoked as part of a function call, and not as a property assignment
+ * such as val foo = @Composable {}
+ * 4. The receiver type of the function call is `Function0` (i.e, we are invoking something
+ * that matches `() -> Unit` - this both avoids non-lambda invocations but also makes sure
+ * that we don't warn for lambdas that have parameters, such as @Composable() (Int) -> Unit
+ * - this cannot be inlined.)
+ * 5. The outer function call that contains this lambda is not a call to a `ComponentNode`
+ * (because these are technically constructor invocations that we just intercept calls to
+ * there is no way to avoid using a trailing lambda for this)
+ * 6. The lambda is not being passed as a parameter, for example `Foo { lambda -> lambda() }`
+ */
+ class UnnecessaryLambdaCreationHandler(private val context: JavaContext) : UElementHandler() {
+
+ override fun visitLambdaExpression(node: ULambdaExpression) {
+ val expressions = (node.body as? KotlinUBlockExpression)?.expressions ?: return
+
+ if (expressions.size != 1) return
+
+ val expression = when (val expr = expressions.first()) {
+ is KotlinUFunctionCallExpression -> expr
+ is KotlinUImplicitReturnExpression ->
+ expr.returnExpression as? KotlinUFunctionCallExpression
+ else -> null
+ } ?: return
+
+ // We want to make sure this lambda is being invoked in the context of a function call,
+ // and not as a property assignment.
+ val parentExpression = node.uastParent!!.sourcePsi as? KtCallExpression ?: return
+
+ // If the expression has no receiver, it is not a lambda invocation
+ val receiverType = expression.receiverType as? PsiClassReferenceType ?: return
+
+ // Ignore function types with multiple parameters such as Function1, Function2 etc.
+ if (receiverType.reference.referenceName != function0SimpleName) return
+
+ if (parentExpression.isComponentNodeInvocation()) return
+
+ val lambdaName = expression.methodIdentifier!!.name
+ if (node.valueParameters.any { it.name == lambdaName }) return
+
+ context.report(
+ ISSUE,
+ node,
+ context.getNameLocation(expression),
+ "Creating an unnecessary lambda to emit a captured lambda"
+ )
+ }
+ }
+
+ companion object {
+ private fun KtCallExpression.isComponentNodeInvocation() =
+ referenceExpression()!!.text.endsWith("Node")
+
+ private val function0SimpleName = Function0::class.simpleName!!
+
+ private const val explanation =
+ "Creating this extra lambda instead of just passing the already captured lambda means" +
+ " that during code generation the Compose compiler will insert code around " +
+ "this lambda to track invalidations. This adds some extra runtime cost so you" +
+ " should instead just directly pass the lambda as a parameter to the function."
+
+ val ISSUE = Issue.create(
+ "UnnecessaryLambdaCreation",
+ "Creating an unnecessary lambda to emit a captured lambda",
+ explanation,
+ Category.PERFORMANCE, 5, Severity.ERROR,
+ Implementation(
+ UnnecessaryLambdaCreationDetector::class.java,
+ Scope.JAVA_FILE_SCOPE
+ )
+ )
+ }
+}
diff --git a/ui/ui-internal-lint-checks/src/main/resources/META-INF/services/com.android.tools.lint.client.api.IssueRegistry b/ui/ui-internal-lint-checks/src/main/resources/META-INF/services/com.android.tools.lint.client.api.IssueRegistry
new file mode 100644
index 0000000..2671c10
--- /dev/null
+++ b/ui/ui-internal-lint-checks/src/main/resources/META-INF/services/com.android.tools.lint.client.api.IssueRegistry
@@ -0,0 +1 @@
+androidx.ui.lint.ComposeIssueRegistry
diff --git a/ui/ui-internal-lint-checks/src/test/java/androidx/ui/lint/UnnecessaryLambdaCreationDetectorTest.kt b/ui/ui-internal-lint-checks/src/test/java/androidx/ui/lint/UnnecessaryLambdaCreationDetectorTest.kt
new file mode 100644
index 0000000..1546fdf
--- /dev/null
+++ b/ui/ui-internal-lint-checks/src/test/java/androidx/ui/lint/UnnecessaryLambdaCreationDetectorTest.kt
@@ -0,0 +1,196 @@
+/*
+ * Copyright 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package androidx.ui.lint
+
+import com.android.tools.lint.checks.infrastructure.TestFiles.kt
+import com.android.tools.lint.checks.infrastructure.TestLintResult
+import com.android.tools.lint.checks.infrastructure.TestLintTask
+import org.junit.Test
+import org.junit.runner.RunWith
+import org.junit.runners.JUnit4
+import androidx.ui.lint.UnnecessaryLambdaCreationDetector.Companion.ISSUE
+import org.intellij.lang.annotations.Language
+
+/* ktlint-disable max-line-length */
+@RunWith(JUnit4::class)
+class UnnecessaryLambdaCreationDetectorTest {
+
+ private val stub = kt("""
+ package test
+
+ annotation class Composable
+
+ val lambda = @Composable { }
+ val anonymousFunction = @Composable fun() {}
+ val lambdaWithReceiver = @Composable { number: Int -> }
+ val anonymousFunctionWithReceiver = @Composable fun(number: Int) {}
+ fun function() {}
+
+ @Composable
+ fun ComposableFunction(children: @Composable() () -> Unit) {
+ children()
+ }
+ """).indented().within("src")
+
+ private fun check(@Language("kotlin") code: String): TestLintResult {
+ return TestLintTask.lint()
+ .files(kt(code.trimIndent()), stub)
+ .allowMissingSdk(true)
+ .issues(ISSUE)
+ .run()
+ }
+
+ @Test
+ fun warnsForSingleExpressions() {
+ check("""
+ package test
+
+ @Composable
+ fun Test() {
+ ComposableFunction {
+ lambda()
+ }
+
+ ComposableFunction {
+ anonymousFunction()
+ }
+
+ ComposableFunction {
+ lambdaWithReceiver(10)
+ }
+
+ ComposableFunction {
+ anonymousFunctionWithReceiver(10)
+ }
+
+ ComposableFunction {
+ function()
+ }
+ }
+ """).expect("""
+src/test/test.kt:6: Error: Creating an unnecessary lambda to emit a captured lambda [UnnecessaryLambdaCreation]
+ lambda()
+ ~~~~~~
+src/test/test.kt:10: Error: Creating an unnecessary lambda to emit a captured lambda [UnnecessaryLambdaCreation]
+ anonymousFunction()
+ ~~~~~~~~~~~~~~~~~
+2 errors, 0 warnings
+ """)
+ }
+
+ @Test
+ fun warnsForMultipleLambdas() {
+ check("""
+ package test
+
+ @Composable
+ fun MultipleChildComposableFunction(
+ firstChild: @Composable() () -> Unit,
+ secondChild: @Composable() () -> Unit
+ ) {}
+
+ @Composable
+ fun Test() {
+ MultipleChildComposableFunction( { lambda() }) {
+ lambda()
+ }
+ }
+ """).expect("""
+src/test/test.kt:11: Error: Creating an unnecessary lambda to emit a captured lambda [UnnecessaryLambdaCreation]
+ MultipleChildComposableFunction( { lambda() }) {
+ ~~~~~~
+src/test/test.kt:12: Error: Creating an unnecessary lambda to emit a captured lambda [UnnecessaryLambdaCreation]
+ lambda()
+ ~~~~~~
+2 errors, 0 warnings
+ """)
+ }
+
+ @Test
+ fun ignoresMultipleExpressions() {
+ check("""
+ package test
+
+ @Composable
+ fun Test() {
+ ComposableFunction {
+ lambda()
+ lambda()
+ }
+ }
+ """).expectClean()
+ }
+
+ @Test
+ fun ignoresPropertyAssignment() {
+ check("""
+ package test
+
+ val property: @Composable() () -> Unit = {
+ lambda()
+ }
+ """).expectClean()
+ }
+
+ @Test
+ fun ignoresComponentNodes() {
+ check("""
+ package test
+
+ class FooNode(val foo: String)
+
+ @Composable
+ fun Test() {
+ FooNode(foo) {
+ lambda()
+ }
+ }
+ """).expectClean()
+ }
+
+ @Test
+ fun ignoresParameterInvocations() {
+ check("""
+ package test
+
+ @Composable
+ fun ComposableFunctionWithParams(
+ child: @Composable() (child: @Composable() () -> Unit) -> Unit
+ ) {}
+
+ @Composable
+ fun Test() {
+ ComposableFunctionWithParams { ignoredChild ->
+ lambda()
+ }
+ }
+
+ @Composable
+ fun Test() {
+ ComposableFunctionWithParams { invokedChild ->
+ invokedChild()
+ }
+ }
+ """).expect("""
+src/test/test.kt:11: Error: Creating an unnecessary lambda to emit a captured lambda [UnnecessaryLambdaCreation]
+ lambda()
+ ~~~~~~
+1 errors, 0 warnings
+ """)
+ }
+}
+/* ktlint-enable max-line-length */
diff --git a/ui/ui-layout/integration-tests/layout-demos/src/main/java/androidx/ui/layout/demos/LayoutActivity.kt b/ui/ui-layout/integration-tests/layout-demos/src/main/java/androidx/ui/layout/demos/LayoutActivity.kt
index 5dce8df..c46cab9 100644
--- a/ui/ui-layout/integration-tests/layout-demos/src/main/java/androidx/ui/layout/demos/LayoutActivity.kt
+++ b/ui/ui-layout/integration-tests/layout-demos/src/main/java/androidx/ui/layout/demos/LayoutActivity.kt
@@ -57,9 +57,7 @@
) {
Wrap {
DrawRectangle(color = color)
- Container(width = width, height = height) {
- children()
- }
+ Container(width = width, height = height, children = children)
}
}
diff --git a/ui/ui-layout/src/androidTest/java/androidx/ui/layout/test/PaddingTest.kt b/ui/ui-layout/src/androidTest/java/androidx/ui/layout/test/PaddingTest.kt
index fd16f55..d1dd28a 100644
--- a/ui/ui-layout/src/androidTest/java/androidx/ui/layout/test/PaddingTest.kt
+++ b/ui/ui-layout/src/androidTest/java/androidx/ui/layout/test/PaddingTest.kt
@@ -49,9 +49,7 @@
fun testPadding_IsApplied() = withDensity(density) {
val padding = 10.dp
testPaddingIsAppliedImplementation(padding) { child: @Composable() () -> Unit ->
- Padding(padding = EdgeInsets(padding)) {
- child()
- }
+ Padding(padding = EdgeInsets(padding), children = child)
}
}
@@ -59,9 +57,7 @@
fun testPadding_overloadAll_IsApplied() = withDensity(density) {
val padding = 10.dp
testPaddingIsAppliedImplementation(padding) { child: @Composable() () -> Unit ->
- Padding(padding = padding) {
- child()
- }
+ Padding(padding = padding, children = child)
}
}
@@ -69,9 +65,8 @@
fun testPadding_overloadSides_IsApplied() = withDensity(density) {
val padding = 10.dp
testPaddingIsAppliedImplementation(padding) { child: @Composable() () -> Unit ->
- Padding(left = padding, top = padding, right = padding, bottom = padding) {
- child()
- }
+ Padding(left = padding, top = padding, right = padding, bottom = padding, children =
+ child)
}
}
@@ -84,9 +79,7 @@
padding.right,
padding.bottom
) { child: @Composable() () -> Unit ->
- Padding(padding = padding) {
- child()
- }
+ Padding(padding = padding, children = child)
}
}
@@ -102,9 +95,7 @@
right,
bottom
) { child: @Composable() () -> Unit ->
- Padding(left = left, top = top, right = right, bottom = bottom) {
- child()
- }
+ Padding(left = left, top = top, right = right, bottom = bottom, children = child)
}
}
@@ -112,9 +103,7 @@
fun testPadding_withInsufficientSpace() = withDensity(density) {
val padding = 30.dp
testPaddingWithInsufficientSpaceImplementation(padding) { child: @Composable() () -> Unit ->
- Padding(padding = EdgeInsets(padding)) {
- child()
- }
+ Padding(padding = EdgeInsets(padding), children = child)
}
}
@@ -122,9 +111,7 @@
fun testPadding_overloadAll_withInsufficientSpace() = withDensity(density) {
val padding = 30.dp
testPaddingWithInsufficientSpaceImplementation(padding) { child: @Composable() () -> Unit ->
- Padding(padding = padding) {
- child()
- }
+ Padding(padding = padding, children = child)
}
}
@@ -132,9 +119,7 @@
fun testPadding_overloadSides_withInsufficientSpace() = withDensity(density) {
val padding = 30.dp
testPaddingWithInsufficientSpaceImplementation(padding) { child: @Composable() () -> Unit ->
- Padding(left = 30.dp, right = 30.dp, top = 30.dp, bottom = 30.dp) {
- child()
- }
+ Padding(left = 30.dp, right = 30.dp, top = 30.dp, bottom = 30.dp, children = child)
}
}
diff --git a/ui/ui-layout/src/androidTest/java/androidx/ui/layout/test/SpacingModifierTest.kt b/ui/ui-layout/src/androidTest/java/androidx/ui/layout/test/SpacingModifierTest.kt
index f7c0df1..cd84d9c 100644
--- a/ui/ui-layout/src/androidTest/java/androidx/ui/layout/test/SpacingModifierTest.kt
+++ b/ui/ui-layout/src/androidTest/java/androidx/ui/layout/test/SpacingModifierTest.kt
@@ -68,9 +68,7 @@
fun spacingAllAppliedToChild() = withDensity(density) {
val spacing = 10.dp
testSpacingIsAppliedImplementation(spacing) { child: @Composable() () -> Unit ->
- TestBox(modifier = Spacing(spacing)) {
- child()
- }
+ TestBox(modifier = Spacing(spacing), body = child)
}
}
@@ -92,9 +90,7 @@
spacingRight,
spacingBottom
) { child: @Composable() () -> Unit ->
- TestBox(modifier = spacing) {
- child()
- }
+ TestBox(modifier = spacing, body = child)
}
}
@@ -108,9 +104,7 @@
fun insufficientSpaceAvailable() = withDensity(density) {
val spacing = 30.dp
testSpacingWithInsufficientSpaceImplementation(spacing) { child: @Composable() () -> Unit ->
- TestBox(modifier = Spacing(spacing)) {
- child()
- }
+ TestBox(modifier = Spacing(spacing), body = child)
}
}
diff --git a/ui/ui-material/integration-tests/samples/src/main/java/androidx/ui/material/samples/TabSamples.kt b/ui/ui-material/integration-tests/samples/src/main/java/androidx/ui/material/samples/TabSamples.kt
index a6ecd6d..9f748878 100644
--- a/ui/ui-material/integration-tests/samples/src/main/java/androidx/ui/material/samples/TabSamples.kt
+++ b/ui/ui-material/integration-tests/samples/src/main/java/androidx/ui/material/samples/TabSamples.kt
@@ -287,7 +287,7 @@
@Sampled
@Composable
fun FancyTab(title: String, onClick: () -> Unit, selected: Boolean) {
- MutuallyExclusiveSetItem(selected = selected, onClick() }) {
+ MutuallyExclusiveSetItem(selected = selected, {
Container(height = 50.dp, padding = EdgeInsets(10.dp)) {
Column(
ExpandedHeight,
diff --git a/ui/ui-material/src/androidTest/java/androidx/ui/material/AppBarTest.kt b/ui/ui-material/src/androidTest/java/androidx/ui/material/AppBarTest.kt
index ed5e498..ab5413a 100644
--- a/ui/ui-material/src/androidTest/java/androidx/ui/material/AppBarTest.kt
+++ b/ui/ui-material/src/androidTest/java/androidx/ui/material/AppBarTest.kt
@@ -115,7 +115,7 @@
action = { action ->
OnChildPositioned( coords ->
actionCoords = coords
- }) { action() }
+ }, children = action)
}
)
}
@@ -173,7 +173,7 @@
action = { action ->
OnChildPositioned( coords ->
actionCoords = coords
- }) { action() }
+ }, children = action)
}
)
}
@@ -204,9 +204,7 @@
title = { Text("Title") },
actionData = createImageList(numberOfActions),
action = { action ->
- Semantics(properties = { testTag = tag }) {
- action()
- }
+ Semantics(properties = { testTag = tag }, children = action)
}
)
}
@@ -226,9 +224,7 @@
title = { Text("Title") },
actionData = createImageList(numberOfActions),
action = { action ->
- Semantics(properties = { testTag = tag }) {
- action()
- }
+ Semantics(properties = { testTag = tag }, children = action)
}
)
}
@@ -281,7 +277,7 @@
action = { action ->
OnChildPositioned( coords ->
actionCoords = coords
- }) { action() }
+ }, children = action)
}
)
}
@@ -319,7 +315,7 @@
action = { action ->
OnChildPositioned( coords ->
actionCoords = coords
- }) { action() }
+ }, children = action)
}
)
}
@@ -370,7 +366,7 @@
action = { action ->
OnChildPositioned( coords ->
actionCoords = coords
- }) { action() }
+ }, children = action)
}
)
}
@@ -427,7 +423,7 @@
action = { action ->
OnChildPositioned( coords ->
actionCoords = coords
- }) { action() }
+ }, children = action)
}
)
}
@@ -476,7 +472,7 @@
action = { action ->
OnChildPositioned( coords ->
actionCoords = coords
- }) { action() }
+ }, children = action)
}
)
}
@@ -519,7 +515,7 @@
action = { action ->
OnChildPositioned( coords ->
actionCoords = coords
- }) { action() }
+ }, children = action)
}
)
}
@@ -549,9 +545,7 @@
BottomAppBar(
actionData = createImageList(numberOfActions),
action = { action ->
- Semantics(properties = { testTag = tag }) {
- action()
- }
+ Semantics(properties = { testTag = tag }, children = action)
}
)
}
@@ -570,9 +564,7 @@
BottomAppBar(
actionData = createImageList(numberOfActions),
action = { action ->
- Semantics(properties = { testTag = tag }) {
- action()
- }
+ Semantics(properties = { testTag = tag }, children = action)
}
)
}
diff --git a/ui/ui-material/src/androidTest/java/androidx/ui/material/MaterialTest.kt b/ui/ui-material/src/androidTest/java/androidx/ui/material/MaterialTest.kt
index 748b99f..25e5e69 100644
--- a/ui/ui-material/src/androidTest/java/androidx/ui/material/MaterialTest.kt
+++ b/ui/ui-material/src/androidTest/java/androidx/ui/material/MaterialTest.kt
@@ -28,9 +28,7 @@
fun ComposeTestRule.setMaterialContent(composable: @Composable() () -> Unit) {
setContent {
MaterialTheme {
- Surface {
- composable()
- }
+ Surface(children = composable)
}
}
}
@@ -51,8 +49,6 @@
{ setMaterialContent(it) }
) {
MaterialTheme {
- Surface {
- children()
- }
+ Surface(children = children)
}
}
\ No newline at end of file
diff --git a/ui/ui-material/src/main/java/androidx/ui/material/AlertDialog.kt b/ui/ui-material/src/main/java/androidx/ui/material/AlertDialog.kt
index 125931f..f54a720 100644
--- a/ui/ui-material/src/main/java/androidx/ui/material/AlertDialog.kt
+++ b/ui/ui-material/src/main/java/androidx/ui/material/AlertDialog.kt
@@ -85,9 +85,7 @@
padding = TitlePadding
) {
val textStyle = +themeTextStyle { h6 }
- CurrentTextStyleProvider(textStyle) {
- title()
- }
+ CurrentTextStyleProvider(textStyle, title)
}
} else {
// TODO(b/138924683): Temporary until padding for the Text's
@@ -97,9 +95,7 @@
Container(alignment = Alignment.CenterLeft, padding = TextPadding) {
val textStyle = +themeTextStyle { body1 }
- CurrentTextStyleProvider(textStyle) {
- text()
- }
+ CurrentTextStyleProvider(textStyle, text)
}
HeightSpacer(height = TextToButtonsHeight)
AlertDialogButtonLayout(
diff --git a/ui/ui-material/src/main/java/androidx/ui/material/Drawer.kt b/ui/ui-material/src/main/java/androidx/ui/material/Drawer.kt
index 9c17bdc..2219dd4 100644
--- a/ui/ui-material/src/main/java/androidx/ui/material/Drawer.kt
+++ b/ui/ui-material/src/main/java/androidx/ui/material/Drawer.kt
@@ -84,9 +84,7 @@
fun StaticDrawer(
drawerContent: @Composable() () -> Unit
) {
- Container(width = StaticDrawerWidth, expanded = true) {
- drawerContent()
- }
+ Container(width = StaticDrawerWidth, expanded = true, children = drawerContent)
}
/**
@@ -250,7 +248,7 @@
padding = EdgeInsets(right = VerticalDrawerPadding)
) {
// remove Container when we will support multiply children
- Surface { Container(expanded = true) { children() } }
+ Surface { Container(expanded = true, children = children) }
}
}
}
@@ -264,7 +262,7 @@
WithOffset(yOffset = yOffset) {
Container(constraints = constraints) {
// remove Container when we will support multiply children
- Surface { Container(expanded = true) { children() } }
+ Surface { Container(expanded = true, children = children) }
}
}
}
@@ -305,9 +303,7 @@
child: @Composable() () -> Unit
) {
Layout(children = {
- RepaintBoundary {
- child()
- }
+ RepaintBoundary(children = child)
}) { measurables, constraints ->
if (measurables.size > 1) {
throw IllegalStateException("Only one child is allowed")
diff --git a/ui/ui-material/src/main/java/androidx/ui/material/ProgressIndicator.kt b/ui/ui-material/src/main/java/androidx/ui/material/ProgressIndicator.kt
index 052c393..0d9a42a 100644
--- a/ui/ui-material/src/main/java/androidx/ui/material/ProgressIndicator.kt
+++ b/ui/ui-material/src/main/java/androidx/ui/material/ProgressIndicator.kt
@@ -283,9 +283,11 @@
private fun CircularIndicatorContainer(children: @Composable() () -> Unit) {
Wrap {
Padding(CircularIndicatorPadding) {
- Container(width = CircularIndicatorDiameter, height = CircularIndicatorDiameter) {
- children()
- }
+ Container(
+ width = CircularIndicatorDiameter,
+ height = CircularIndicatorDiameter,
+ children = children
+ )
}
}
}
diff --git a/ui/ui-material/src/main/java/androidx/ui/material/RadioButton.kt b/ui/ui-material/src/main/java/androidx/ui/material/RadioButton.kt
index d728130..51e0143 100644
--- a/ui/ui-material/src/main/java/androidx/ui/material/RadioButton.kt
+++ b/ui/ui-material/src/main/java/androidx/ui/material/RadioButton.kt
@@ -64,7 +64,7 @@
@Composable
fun RadioGroup(children: @Composable RadioGroupScope.() -> Unit) {
val scope = +memo { RadioGroupScope() }
- children(p1 = scope)
+ scope.children()
}
/**
@@ -136,9 +136,7 @@
Ripple(bounded = true) {
MutuallyExclusiveSetItem(
selected = selected,
- if (!selected) onSelect() }) {
- children()
- }
+ if (!selected) onSelect() }, children = children)
}
}
}
diff --git a/ui/ui-material/src/main/java/androidx/ui/material/Tab.kt b/ui/ui-material/src/main/java/androidx/ui/material/Tab.kt
index 2940b07..c447e22 100644
--- a/ui/ui-material/src/main/java/androidx/ui/material/Tab.kt
+++ b/ui/ui-material/src/main/java/androidx/ui/material/Tab.kt
@@ -169,14 +169,10 @@
Stack {
aligned(Alignment.Center) {
FlexRow {
- expanded(1f) {
- tabs()
- }
+ expanded(1f, tabs)
}
}
- aligned(Alignment.BottomCenter) {
- divider()
- }
+ aligned(Alignment.BottomCenter, children = divider)
positioned(0.dp, 0.dp, 0.dp, 0.dp) {
indicatorContainer(tabPositions)
}
@@ -368,9 +364,7 @@
Container(expanded = true, alignment = Alignment.BottomLeft) {
IndicatorTransition(tabPositions, selectedIndex) { indicatorOffset ->
Padding(left = withDensity(+ambientDensity()) { indicatorOffset.toDp() }) {
- Container(width = currentTabWidth) {
- indicator()
- }
+ Container(width = currentTabWidth, children = indicator)
}
}
}
@@ -469,9 +463,7 @@
@Composable
private fun BaseTab(selected: Boolean, onSelected: () -> Unit, children: @Composable() () -> Unit) {
Ripple(bounded = true) {
- MutuallyExclusiveSetItem(selected = selected, {
- children()
- }
+ MutuallyExclusiveSetItem(selected = selected, children = children)
}
}
diff --git a/ui/ui-material/src/main/java/androidx/ui/material/ripple/Ripple.kt b/ui/ui-material/src/main/java/androidx/ui/material/ripple/Ripple.kt
index a630634..0cf1823 100644
--- a/ui/ui-material/src/main/java/androidx/ui/material/ripple/Ripple.kt
+++ b/ui/ui-material/src/main/java/androidx/ui/material/ripple/Ripple.kt
@@ -126,7 +126,7 @@
density,
radius,
bounded,
- { recompose() },
+ recompose,
onAnimationFinished
)
diff --git a/ui/ui-test/src/main/java/androidx/ui/test/SizesTesting.kt b/ui/ui-test/src/main/java/androidx/ui/test/SizesTesting.kt
index 24c4ee1..de26718 100644
--- a/ui/ui-test/src/main/java/androidx/ui/test/SizesTesting.kt
+++ b/ui/ui-test/src/main/java/androidx/ui/test/SizesTesting.kt
@@ -55,9 +55,7 @@
ConstrainedBox(constraints = parentConstraints) {
OnChildPositioned( coordinates ->
realSize = coordinates.size
- }) {
- children()
- }
+ }, children = children)
}
}
}
diff --git a/ui/ui-tooling/src/main/java/androidx/ui/tooling/Inspectable.kt b/ui/ui-tooling/src/main/java/androidx/ui/tooling/Inspectable.kt
index 9cbca8a..579b4bf 100644
--- a/ui/ui-tooling/src/main/java/androidx/ui/tooling/Inspectable.kt
+++ b/ui/ui-tooling/src/main/java/androidx/ui/tooling/Inspectable.kt
@@ -32,9 +32,7 @@
fun Inspectable(children: @Composable() () -> Unit) {
composer.composer.collectKeySourceInformation()
tables.add(composer.composer.slotTable)
- InspectionMode.Provider(true) {
- children()
- }
+ InspectionMode.Provider(true, children)
}
val tables = Collections.newSetFromMap(WeakHashMap<SlotTable, Boolean>())