Merge pull request #162 from hikarin522/patch-3

Fix UniTaskExtensions.Unwrap()
master
Yoshifumi Kawai 2020-09-09 15:38:03 +09:00 committed by GitHub
commit f1e4a3c65d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 23 additions and 3 deletions

View File

@ -732,7 +732,7 @@ namespace Cysharp.Threading.Tasks
return await await task; return await await task;
} }
public static async UniTask Unwrap<T>(this UniTask<UniTask> task) public static async UniTask Unwrap(this UniTask<UniTask> task)
{ {
await await task; await await task;
} }
@ -741,22 +741,42 @@ namespace Cysharp.Threading.Tasks
{ {
return await await task; return await await task;
} }
public static async UniTask<T> Unwrap<T>(this Task<UniTask<T>> task, bool continueOnCapturedContext)
{
return await await task.ConfigureAwait(continueOnCapturedContext);
}
public static async UniTask Unwrap<T>(this Task<UniTask> task) public static async UniTask Unwrap(this Task<UniTask> task)
{ {
await await task; await await task;
} }
public static async UniTask Unwrap(this Task<UniTask> task, bool continueOnCapturedContext)
{
await await task.ConfigureAwait(continueOnCapturedContext);
}
public static async UniTask<T> Unwrap<T>(this UniTask<Task<T>> task) public static async UniTask<T> Unwrap<T>(this UniTask<Task<T>> task)
{ {
return await await task; return await await task;
} }
public static async UniTask<T> Unwrap<T>(this UniTask<Task<T>> task, bool continueOnCapturedContext)
{
return await (await task).ConfigureAwait(continueOnCapturedContext);
}
public static async UniTask Unwrap<T>(this UniTask<Task> task) public static async UniTask Unwrap(this UniTask<Task> task)
{ {
await await task; await await task;
} }
public static async UniTask Unwrap(this UniTask<Task> task, bool continueOnCapturedContext)
{
await (await task).ConfigureAwait(continueOnCapturedContext);
}
#if UNITY_2018_3_OR_NEWER #if UNITY_2018_3_OR_NEWER
sealed class ToCoroutineEnumerator : IEnumerator sealed class ToCoroutineEnumerator : IEnumerator