Files
swift-mirror/test/refactoring/ExtractFunction/Outputs/await/async2.swift.expected
Hamish Knight 8d92241ca9 [Refactoring] Support async for function extraction
Adapt the `ThrowingEntityAnalyzer` to pick up any
`await` keywords and add an `async` to the extracted
function if necessary along with an `await` for its
call.

rdar://72199949
2021-05-26 12:40:35 +01:00

16 lines
462 B
Plaintext

func longLongLongJourney() async -> Int { 0 }
func longLongLongAwryJourney() async throws -> Int { 0 }
func consumesAsync(_ fn: () async throws -> Void) rethrows {}
fileprivate func new_name() async throws -> Int {
return try await longLongLongAwryJourney() + 1
}
func testThrowingClosure() async throws -> Int {
let x = await longLongLongJourney()
let y = try await new_name()
try consumesAsync { try await longLongLongAwryJourney() }
return x + y
}