Permalink
Browse files

Remove all getWaitHandle

Summary:
- This removes all references to getWaitHandle in hphp/hack
- We are removing it from HHVM so Hack should not use it

Reviewed By: jano

Differential Revision: D6912922

fbshipit-source-id: e68d2a76ddba047690ac5d6f61019693930f4531
  • Loading branch information...
WizKid authored and hhvm-bot committed Feb 7, 2018
1 parent 0464f8d commit 5575547c8f4971c7ee99c9e6751cff7911be5495
@@ -1,5 +1,5 @@
<?hh
function f(Awaitable<int> $a): void {
function f(Generator<int, int, int> $a): void {
$a->AUTO332
}
@@ -1 +1,8 @@
getWaitHandle abs (function(): WaitHandle<T>)
valid (function(): bool)
send (function(?Ts $v): void)
rewind (function(): void)
raise (function(Exception $e): void)
next (function(): void)
key (function(): Tk)
getOrigFuncName (function(): string)
current (function(): Tv)
@@ -55,21 +55,14 @@ class Foo {
}
function prep<T>(Awaitable<T> $aw): T {
/* HH_FIXME[4053]: WaitHandle missing join in hh_single_type_check */
return $aw->getWaitHandle()->join();
return HH\Asio\join($aw);
}
async function gena_<Tk, Tv>(
KeyedTraversable<Tk, Awaitable<Tv>> $awaitables,
): Awaitable<array<Tv>> {
$wait_handles = array();
foreach ($awaitables as $index => $awaitable) {
$wait_handles[$index] = $awaitable->getWaitHandle();
}
/* HH_FIXME[2049] */
/* HH_FIXME[4026] */
await AwaitAllWaitHandle::fromArray($wait_handles);
return array_map($wh ==> \HH\Asio\result($wh), $wait_handles);
await AwaitAllWaitHandle::fromArray($awaitables);
return array_map($wh ==> \HH\Asio\result($wh), $awaitables);
}
function wait(): Awaitable<void> {
@@ -41,20 +41,13 @@ class Argh {
}
function prep<T>(Awaitable<T> $aw): T {
/* HH_FIXME[4053]: WaitHandle missing join in hh_single_type_check */
return $aw->getWaitHandle()->join();
return HH\Asio\join($aw);
}
async function gena_<Tk, Tv>(
KeyedTraversable<Tk, Awaitable<Tv>> $awaitables,
): Awaitable<array<Tv>> {
$wait_handles = array();
foreach ($awaitables as $index => $awaitable) {
$wait_handles[$index] = $awaitable->getWaitHandle();
}
/* HH_FIXME[2049] */
/* HH_FIXME[4026] */
await AwaitAllWaitHandle::fromArray($wait_handles);
return array_map($wh ==> \HH\Asio\result($wh), $wait_handles);
await AwaitAllWaitHandle::fromArray($awaitables);
return array_map($wh ==> \HH\Asio\result($wh), $awaitables);
}
async function lurr(): Awaitable<void> {
@@ -1,5 +1,5 @@
<?hh
// AUTOCOMPLETE 4 7
function f(Awaitable<int> $a): void {
function f(Generator<int, int, int> $a): void {
$a->
}
@@ -1 +1,8 @@
getWaitHandle
current
getOrigFuncName
key
next
raise
rewind
send
valid
@@ -34,19 +34,8 @@ class MyPreparable extends Preparable {}
}
abstract class GeneratorLegacyPreparable implements IPreparable<this> {
private ?Awaitable<this> $wh = null;
private bool $started = false;
final public function getWaitHandle(): Awaitable<this> {
if ($this->wh === null) {
invariant($this->started === false, 'cannot depend on $this');
$this->started = true;
$wh = $this->__genGen();
$this->wh = $wh;
}
return $this->wh;
}
<<__Memoize>>
private async function __genGen(): Awaitable<this> {
await $this->gen();
return $this;
@@ -42,7 +42,7 @@ public function one(): @int {
}
one();
two()->getWaitHandle()->join();
HH\Asio\join(two());
$d = new D();
$d->one();
$d->two()->getWaitHandle()->join();
HH\Asio\join($d->two());

0 comments on commit 5575547

Please sign in to comment.