private async function __flushElementChildren()

in src/core/Primitive.hack [39:60]


  private async function __flushElementChildren(): Awaitable<void> {
    $children = $this->getChildren();
    $awaitables = dict[];
    foreach ($children as $idx => $child) {
      if ($child is node) {
        $child->__transferContext($this->getAllContexts());
        $awaitables[$idx] = $child->__flushSubtree();
      }
    }
    if ($awaitables) {
      $awaited = await Dict\from_async($awaitables);
      foreach ($awaited as $idx => $child) {
        $children[$idx] = $child;
      }
    }
    if ($this->__isRendered) {
      throw new UseAfterRenderException(
        'Attempted to render XHP element twice',
      );
    }
    $this->replaceChildren($children);
  }