mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
I will remove the `syntactic-rename` refactoring action in a follow-up commit. Clients should always ask for rename ranges and perform the rename by themselves instead of asking for a renamed file.
38 lines
1.1 KiB
Plaintext
38 lines
1.1 KiB
Plaintext
public struct Outer {
|
|
@propertyWrapper
|
|
public struct InnerWrapper<T> {
|
|
public var wrappedValue: T
|
|
public /*init:def*/<keywordBase>init</keywordBase>(<arglabel index=0>initialValue</arglabel><param index=0></param>: T) {
|
|
self.wrappedValue = initialValue
|
|
}
|
|
public /*body:def*/init(first: Int, body: () -> T) {
|
|
self.wrappedValue = body()
|
|
}
|
|
}
|
|
}
|
|
|
|
var globalInt: Int { return 17 }
|
|
public struct HasWrappers {
|
|
@Outer.InnerWrapper
|
|
public var x: Int = globalInt
|
|
|
|
@Outer . /*body:call*/InnerWrapper(first: 20, body: { globalInt })
|
|
public var y: Int
|
|
|
|
@Outer . /*body:call*/InnerWrapper(first: 10, body: {
|
|
struct Inner {
|
|
@Outer . /*init:call*/InnerWrapper(<callarg index=0>initialValue</callarg><callcolon index=0>: </callcolon>globalInt)
|
|
var x: Int
|
|
}
|
|
return Inner().x + globalInt
|
|
})
|
|
public var z: Int
|
|
}
|
|
|
|
func uses() {
|
|
_ = Outer . /*body:call*/InnerWrapper(first: 42, body: { 45 })
|
|
_ = Outer . /*init:call*/InnerWrapper(<callarg index=0>initialValue</callarg><callcolon index=0>: </callcolon>0)
|
|
}
|
|
|
|
|