-
Notifications
You must be signed in to change notification settings - Fork 198
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2160f23
commit a265759
Showing
3 changed files
with
44 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
Tests/SwiftKotlinFrameworkTests/Tests/KotlinTokenizer/annotations.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
var completionHandlers: List<() -> Unit> = listOf() | ||
|
||
fun someFunctionWithEscapingClosure(completionHandler: () -> Unit) { | ||
completionHandlers.append(completionHandler) | ||
} | ||
|
||
fun serve(customerProvider: () -> String) { | ||
print("Now serving ${customerProvider()}!") | ||
} | ||
|
||
fun collectCustomerProviders(customerProvider: () -> String) { | ||
customerProviders.append(customerProvider) | ||
} | ||
|
||
fun foo(code: (() -> String)) : String { | ||
return "foo ${bar(code)}" | ||
} |
20 changes: 20 additions & 0 deletions
20
Tests/SwiftKotlinFrameworkTests/Tests/KotlinTokenizer/annotations.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
|
||
// escaping | ||
var completionHandlers: [() -> Void] = [] | ||
func someFunctionWithEscapingClosure(completionHandler: @escaping () -> Void) { | ||
completionHandlers.append(completionHandler) | ||
} | ||
|
||
func serve(customer customerProvider: @autoclosure () -> String) { | ||
print("Now serving \(customerProvider())!") | ||
} | ||
|
||
func collectCustomerProviders(_ customerProvider: @autoclosure @escaping () -> String) { | ||
customerProviders.append(customerProvider) | ||
} | ||
|
||
@discardableResult | ||
func foo(_ code:(() -> String)) -> String { | ||
return "foo \(bar(code))" | ||
} | ||
|