public static function fromJSON()

in codegen/syntax/ForStatement.hack [54:158]


  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['for_keyword']) as dict<_, _>,
      $file,
      $offset,
      $source,
      'ForToken',
    );
    $keyword = $keyword as nonnull;
    $offset += $keyword->getWidth();
    $left_paren = Node::fromJSON(
      ($json['for_left_paren']) as dict<_, _>,
      $file,
      $offset,
      $source,
      'LeftParenToken',
    );
    $left_paren = $left_paren as nonnull;
    $offset += $left_paren->getWidth();
    $initializer = Node::fromJSON(
      ($json['for_initializer'] ?? dict['kind' => 'missing']) as dict<_, _>,
      $file,
      $offset,
      $source,
      'NodeList<ListItem<IExpression>>',
    );
    $offset += $initializer?->getWidth() ?? 0;
    $first_semicolon = Node::fromJSON(
      ($json['for_first_semicolon']) as dict<_, _>,
      $file,
      $offset,
      $source,
      'SemicolonToken',
    );
    $first_semicolon = $first_semicolon as nonnull;
    $offset += $first_semicolon->getWidth();
    $control = Node::fromJSON(
      ($json['for_control'] ?? dict['kind' => 'missing']) as dict<_, _>,
      $file,
      $offset,
      $source,
      'IExpression',
    );
    $offset += $control?->getWidth() ?? 0;
    $second_semicolon = Node::fromJSON(
      ($json['for_second_semicolon']) as dict<_, _>,
      $file,
      $offset,
      $source,
      'SemicolonToken',
    );
    $second_semicolon = $second_semicolon as nonnull;
    $offset += $second_semicolon->getWidth();
    $end_of_loop = Node::fromJSON(
      ($json['for_end_of_loop'] ?? dict['kind' => 'missing']) as dict<_, _>,
      $file,
      $offset,
      $source,
      'NodeList<ListItem<IExpression>>',
    );
    $offset += $end_of_loop?->getWidth() ?? 0;
    $right_paren = Node::fromJSON(
      ($json['for_right_paren']) as dict<_, _>,
      $file,
      $offset,
      $source,
      'RightParenToken',
    );
    $right_paren = $right_paren as nonnull;
    $offset += $right_paren->getWidth();
    $body = Node::fromJSON(
      ($json['for_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] */ $initializer,
      /* HH_IGNORE_ERROR[4110] */ $first_semicolon,
      /* HH_IGNORE_ERROR[4110] */ $control,
      /* HH_IGNORE_ERROR[4110] */ $second_semicolon,
      /* HH_IGNORE_ERROR[4110] */ $end_of_loop,
      /* HH_IGNORE_ERROR[4110] */ $right_paren,
      /* HH_IGNORE_ERROR[4110] */ $body,
      $source_ref,
    );
  }