Skip to content

Commit f7005d5

Browse files
committed
stdlib: clean up code: arrays of functions work now
Swift SVN r32424
1 parent aba0903 commit f7005d5

File tree

1 file changed

+5
-15
lines changed

1 file changed

+5
-15
lines changed

stdlib/public/core/REPL.swift

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -10,25 +10,15 @@
1010
//
1111
//===----------------------------------------------------------------------===//
1212

13-
// FIXME: Function types don't work yet as generic parameters
14-
public struct _REPLExitHandler {
15-
var f : () -> ()
13+
internal var _replExitHandlers: [() -> Void] = []
1614

17-
init(_ f: () -> ()) {
18-
self.f = f
19-
}
20-
}
21-
22-
var _replExitHandlers = [_REPLExitHandler]()
23-
24-
public func _atREPLExit(handler: () -> ()) {
25-
_replExitHandlers.append(_REPLExitHandler(handler))
15+
public func _atREPLExit(handler: () -> Void) {
16+
_replExitHandlers.append(handler)
2617
}
2718

2819
internal func _replExit() {
29-
let reversed = _replExitHandlers.reverse()
30-
for handler in reversed {
31-
handler.f()
20+
for handler in _replExitHandlers.reverse() {
21+
handler()
3222
}
3323
}
3424

0 commit comments

Comments
 (0)