mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Merge remote-tracking branch 'origin/master' into swift-3-indexing-model
This commit is contained in:
@@ -21,7 +21,7 @@
|
||||
//
|
||||
|
||||
@warn_unused_result
|
||||
func _toNSArray<T, U : AnyObject>(_ a: [T], @noescape f: (T) -> U) -> NSArray {
|
||||
func _toNSArray<T, U : AnyObject>(_ a: [T], f: @noescape (T) -> U) -> NSArray {
|
||||
let result = NSMutableArray(capacity: a.count)
|
||||
for s in a {
|
||||
result.add(f(s))
|
||||
@@ -79,7 +79,7 @@ extension Optional {
|
||||
/// `body` is complicated than that results in unnecessarily repeated code.
|
||||
internal func _withNilOrAddress<NSType : AnyObject, ResultType>(
|
||||
of object: inout NSType?,
|
||||
body: @noescape AutoreleasingUnsafeMutablePointer<NSType?>? -> ResultType
|
||||
body: @noescape (AutoreleasingUnsafeMutablePointer<NSType?>?) -> ResultType
|
||||
) -> ResultType {
|
||||
return self == nil ? body(nil) : body(&object)
|
||||
}
|
||||
@@ -125,7 +125,7 @@ extension String {
|
||||
/// memory referred to by `index`
|
||||
func _withOptionalOutParameter<Result>(
|
||||
_ index: UnsafeMutablePointer<Index>?,
|
||||
@noescape _ body: (UnsafeMutablePointer<Int>?) -> Result
|
||||
_ body: @noescape (UnsafeMutablePointer<Int>?) -> Result
|
||||
) -> Result {
|
||||
var utf16Index: Int = 0
|
||||
let result = (index != nil ? body(&utf16Index) : body(nil))
|
||||
@@ -138,7 +138,7 @@ extension String {
|
||||
/// it into the memory referred to by `range`
|
||||
func _withOptionalOutParameter<Result>(
|
||||
_ range: UnsafeMutablePointer<Range<Index>>?,
|
||||
@noescape _ body: (UnsafeMutablePointer<NSRange>?) -> Result
|
||||
_ body: @noescape (UnsafeMutablePointer<NSRange>?) -> Result
|
||||
) -> Result {
|
||||
var nsRange = NSRange(location: 0, length: 0)
|
||||
let result = (range != nil ? body(&nsRange) : body(nil))
|
||||
|
||||
Reference in New Issue
Block a user