Skip to content

Commit 53ae7f5

Browse files
committed
75176: Swift 3.0: SE-0061: Add Generic Result and Error Handling to autoreleasepool()
1 parent 8de8e46 commit 53ae7f5

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

Source/Functions.swift

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,4 +180,24 @@ public func stride(from start: Double, to end: Double, by stride: Double) -> ISe
180180
__yield i;
181181
i += stride
182182
}
183-
}*/
183+
}*/
184+
185+
#if TOFFEE
186+
187+
public func autoreleasepool<T>(_ act: () throws -> (T)) -> T throws {
188+
var res: T;
189+
autoreleasepool {
190+
res = try act();
191+
}
192+
return res;
193+
}
194+
195+
public func autoreleasepool<T>(_ act: () -> (T)) -> T {
196+
var res: T;
197+
autoreleasepool {
198+
res = try act();
199+
}
200+
return res;
201+
}
202+
203+
#endif

0 commit comments

Comments
 (0)