mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Refactor SILGen's ApplyOptions into an OptionSet, add a DoesNotAwait flag to go with DoesNotThrow, and sink it all down into SILInstruction.h. Then, replace the isNonThrowing() flag in ApplyInst and BeginApplyInst with getApplyOptions(), and plumb it through to TryApplyInst as well. Set the flag when SILGen emits a sync call to a reasync function. When set, this disables the SIL verifier check against calling async functions from sync functions. Finally, this allows us to add end-to-end tests for rdar://problem/71098795.
12 lines
339 B
Swift
12 lines
339 B
Swift
@_transparent
|
|
public func and(_ lhs: Bool, _ rhs: @autoclosure () async -> Bool) reasync -> Bool {
|
|
guard lhs else { return false }
|
|
return await rhs()
|
|
}
|
|
|
|
@_transparent
|
|
public func andThrows(_ lhs: Bool, _ rhs: @autoclosure () async throws -> Bool) reasync rethrows -> Bool {
|
|
guard lhs else { return false }
|
|
return try await rhs()
|
|
}
|