public static function fromJSON()

in codegen/syntax/IfStatement.hack [48:133]


  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['if_keyword']) as dict<_, _>,
      $file,
      $offset,
      $source,
      'IfToken',
    );
    $keyword = $keyword as nonnull;
    $offset += $keyword->getWidth();
    $left_paren = Node::fromJSON(
      ($json['if_left_paren']) as dict<_, _>,
      $file,
      $offset,
      $source,
      'LeftParenToken',
    );
    $left_paren = $left_paren as nonnull;
    $offset += $left_paren->getWidth();
    $condition = Node::fromJSON(
      ($json['if_condition']) as dict<_, _>,
      $file,
      $offset,
      $source,
      'IExpression',
    );
    $condition = $condition as nonnull;
    $offset += $condition->getWidth();
    $right_paren = Node::fromJSON(
      ($json['if_right_paren']) as dict<_, _>,
      $file,
      $offset,
      $source,
      'RightParenToken',
    );
    $right_paren = $right_paren as nonnull;
    $offset += $right_paren->getWidth();
    $statement = Node::fromJSON(
      ($json['if_statement']) as dict<_, _>,
      $file,
      $offset,
      $source,
      'IStatement',
    );
    $statement = $statement as nonnull;
    $offset += $statement->getWidth();
    $elseif_clauses = Node::fromJSON(
      ($json['if_elseif_clauses'] ?? dict['kind' => 'missing']) as dict<_, _>,
      $file,
      $offset,
      $source,
      'NodeList<ElseifClause>',
    );
    $offset += $elseif_clauses?->getWidth() ?? 0;
    $else_clause = Node::fromJSON(
      ($json['if_else_clause'] ?? dict['kind' => 'missing']) as dict<_, _>,
      $file,
      $offset,
      $source,
      'ElseClause',
    );
    $offset += $else_clause?->getWidth() ?? 0;
    $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] */ $condition,
      /* HH_IGNORE_ERROR[4110] */ $right_paren,
      /* HH_IGNORE_ERROR[4110] */ $statement,
      /* HH_IGNORE_ERROR[4110] */ $elseif_clauses,
      /* HH_IGNORE_ERROR[4110] */ $else_clause,
      $source_ref,
    );
  }