-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Deprecate C\first_async (aka C\gen_first)
Summary: `C\first_async()` is made obsolete by await-as-an-expression in Hack. Instead of: await C\first_async(some_async_function()); you should use: C\first(await some_async_function()); Reviewed By: fredemmott Differential Revision: D25890718 fbshipit-source-id: 6dabf456fb4ee33f60294501dad80d4afc5605a1
- Loading branch information
1 parent
83617f1
commit 186ca93
Showing
3 changed files
with
27 additions
and
52 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
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,27 @@ | ||
<?hh | ||
/* | ||
* Copyright (c) 2004-present, Facebook, Inc. | ||
* All rights reserved. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
* | ||
*/ | ||
|
||
namespace HH\Lib\C; | ||
|
||
/** | ||
* Returns the first element of the result of the given Awaitable, or null if | ||
* the Traversable is empty. | ||
* | ||
* For non-Awaitable Traversables, see `C\first`. | ||
* | ||
* Time complexity: O(1) | ||
* Space complexity: O(1) | ||
*/ | ||
<<__Deprecated('use C\\first(await #A)')>> | ||
async function first_async<T>( | ||
Awaitable<Traversable<T>> $awaitable, | ||
): Awaitable<?T> { | ||
return first(await $awaitable); | ||
} |
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