mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Revert "Revert "Reimplement function builders as statement transformations.""
This commit is contained in:
@@ -352,14 +352,20 @@ func acceptComponentBuilder(@ComponentBuilder _ body: () -> Component) {
|
||||
print(body())
|
||||
}
|
||||
|
||||
func colorWithAutoClosure(_ color: @autoclosure () -> Color) -> Color {
|
||||
return color()
|
||||
}
|
||||
|
||||
var trueValue = true
|
||||
acceptComponentBuilder {
|
||||
"hello"
|
||||
if true {
|
||||
if trueValue {
|
||||
3.14159
|
||||
colorWithAutoClosure(.red)
|
||||
}
|
||||
.red
|
||||
}
|
||||
// CHECK: array([main.Component.string("hello"), main.Component.optional(Optional(main.Component.array([main.Component.floating(3.14159)]))), main.Component.color(main.Color.red)])
|
||||
// CHECK: array([main.Component.string("hello"), main.Component.optional(Optional(main.Component.array([main.Component.floating(3.14159), main.Component.color(main.Color.red)]))), main.Component.color(main.Color.red)])
|
||||
|
||||
// rdar://53325810
|
||||
|
||||
|
||||
Reference in New Issue
Block a user