public static function fromJSON()

in codegen/syntax/ForeachStatement.hack [57:172]


  public static function fromJSON(
    dict<arraykey, mixed> $json,
    string $file,
    int $initial_offset,
    string $source,
    string $_type_hint,
  ): this {
    $offset = $initial_offset;
    $keyword = Node::fromJSON(
      ($json['foreach_keyword']) as dict<_, _>,
      $file,
      $offset,
      $source,
      'ForeachToken',
    );
    $keyword = $keyword as nonnull;
    $offset += $keyword->getWidth();
    $left_paren = Node::fromJSON(
      ($json['foreach_left_paren']) as dict<_, _>,
      $file,
      $offset,
      $source,
      'LeftParenToken',
    );
    $left_paren = $left_paren as nonnull;
    $offset += $left_paren->getWidth();
    $collection = Node::fromJSON(
      ($json['foreach_collection']) as dict<_, _>,
      $file,
      $offset,
      $source,
      'IExpression',
    );
    $collection = $collection as nonnull;
    $offset += $collection->getWidth();
    $await_keyword = Node::fromJSON(
      ($json['foreach_await_keyword'] ?? dict['kind' => 'missing'])
        as dict<_, _>,
      $file,
      $offset,
      $source,
      'AwaitToken',
    );
    $offset += $await_keyword?->getWidth() ?? 0;
    $as = Node::fromJSON(
      ($json['foreach_as']) as dict<_, _>,
      $file,
      $offset,
      $source,
      'AsToken',
    );
    $as = $as as nonnull;
    $offset += $as->getWidth();
    $key = Node::fromJSON(
      ($json['foreach_key'] ?? dict['kind' => 'missing']) as dict<_, _>,
      $file,
      $offset,
      $source,
      'IExpression',
    );
    $offset += $key?->getWidth() ?? 0;
    $arrow = Node::fromJSON(
      ($json['foreach_arrow'] ?? dict['kind' => 'missing']) as dict<_, _>,
      $file,
      $offset,
      $source,
      'EqualGreaterThanToken',
    );
    $offset += $arrow?->getWidth() ?? 0;
    $value = Node::fromJSON(
      ($json['foreach_value']) as dict<_, _>,
      $file,
      $offset,
      $source,
      'IExpression',
    );
    $value = $value as nonnull;
    $offset += $value->getWidth();
    $right_paren = Node::fromJSON(
      ($json['foreach_right_paren']) as dict<_, _>,
      $file,
      $offset,
      $source,
      'RightParenToken',
    );
    $right_paren = $right_paren as nonnull;
    $offset += $right_paren->getWidth();
    $body = Node::fromJSON(
      ($json['foreach_body']) as dict<_, _>,
      $file,
      $offset,
      $source,
      'IStatement',
    );
    $body = $body as nonnull;
    $offset += $body->getWidth();
    $source_ref = shape(
      'file' => $file,
      'source' => $source,
      'offset' => $initial_offset,
      'width' => $offset - $initial_offset,
    );
    return new static(
      /* HH_IGNORE_ERROR[4110] */ $keyword,
      /* HH_IGNORE_ERROR[4110] */ $left_paren,
      /* HH_IGNORE_ERROR[4110] */ $collection,
      /* HH_IGNORE_ERROR[4110] */ $await_keyword,
      /* HH_IGNORE_ERROR[4110] */ $as,
      /* HH_IGNORE_ERROR[4110] */ $key,
      /* HH_IGNORE_ERROR[4110] */ $arrow,
      /* HH_IGNORE_ERROR[4110] */ $value,
      /* HH_IGNORE_ERROR[4110] */ $right_paren,
      /* HH_IGNORE_ERROR[4110] */ $body,
      $source_ref,
    );
  }