Skip to content

Commit

Permalink
Allow closureParameter to be "_"
Browse files Browse the repository at this point in the history
  • Loading branch information
a4sriniv committed Aug 8, 2016
1 parent f94fed4 commit eb533c6
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/main/antlr/com/sleekbyte/tailor/antlr/Swift.g4
Original file line number Diff line number Diff line change
Expand Up @@ -607,7 +607,8 @@ closureParameterList: closureParameter (',' closureParameterList)* ;
closureParameter: closureParameterName typeAnnotation?
| closureParameterName typeAnnotation '...'
;
closureParameterName: identifier ;
// Swift Language Reference does not have "_"
closureParameterName: identifier | '_';

captureList : '[' captureListItems ']' ;
captureListItems: captureListItem (',' captureListItem)* ;
Expand Down
9 changes: 9 additions & 0 deletions src/test/swift/com/sleekbyte/tailor/grammar/Closures.swift
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,12 @@ func makeIncrementer(forIncrement amount: Int) -> (Void) -> Int {
downloader?.downloadImage(URLRequest: URLRequest(.GET, "https://httpbin.org/image/png")) { _, _, _ in
// No-op
}

let callbackEnabled = SCNetworkReachabilitySetCallback(
reachability,
{ (_, flags, info) in
let reachability = Unmanaged<NetworkReachabilityManager>.fromOpaque(info!).takeUnretainedValue()
reachability.notifyListener(flags)
},
&context
)

0 comments on commit eb533c6

Please sign in to comment.