stdlib: annotate Array.map() and Array.filter() with @noescape

Now these functions are implemented using protocol extensions, which
are, in turn, implemented with an unsafe hack that casts @noescape away.

rdar://20544096

Swift SVN r27397
This commit is contained in:
Dmitri Hrybenko
2015-04-17 02:17:13 +00:00
parent 2bccb13463
commit 27155549b7

View File

@@ -691,7 +691,7 @@ extension ${Self} : _ArrayType {
/// Return ${a_Self} containing the results of calling
/// `transform(x)` on each element `x` of `self`
public func map<U>(transform: (T) -> U) -> ${Self}<U> {
public func map<U>(@noescape transform: (T) -> U) -> ${Self}<U> {
// FIXME(prext): remove this function when protocol extensions land.
return ${Self}<U>(self._prext_map(transform))
}
@@ -711,7 +711,7 @@ extension ${Self} : _ArrayType {
/// Return ${a_Self} containing the elements `x` of `self` for which
/// `includeElement(x)` is `true`
public func filter(includeElement: (T) -> Bool) -> ${Self} {
public func filter(@noescape includeElement: (T) -> Bool) -> ${Self} {
// FIXME(prext): remove this function when protocol extensions land.
return self._prext_filter(includeElement)
}