public static function fromJSON()

in codegen/syntax/ClassishDeclaration.hack [65:199]


  public static function fromJSON(
    dict<arraykey, mixed> $json,
    string $file,
    int $initial_offset,
    string $source,
    string $_type_hint,
  ): this {
    $offset = $initial_offset;
    $attribute = Node::fromJSON(
      ($json['classish_attribute'] ?? dict['kind' => 'missing']) as dict<_, _>,
      $file,
      $offset,
      $source,
      'OldAttributeSpecification',
    );
    $offset += $attribute?->getWidth() ?? 0;
    $modifiers = Node::fromJSON(
      ($json['classish_modifiers'] ?? dict['kind' => 'missing']) as dict<_, _>,
      $file,
      $offset,
      $source,
      'NodeList<Token>',
    );
    $offset += $modifiers?->getWidth() ?? 0;
    $xhp = Node::fromJSON(
      ($json['classish_xhp'] ?? dict['kind' => 'missing']) as dict<_, _>,
      $file,
      $offset,
      $source,
      'Node',
    );
    $offset += $xhp?->getWidth() ?? 0;
    $keyword = Node::fromJSON(
      ($json['classish_keyword']) as dict<_, _>,
      $file,
      $offset,
      $source,
      'Token',
    );
    $keyword = $keyword as nonnull;
    $offset += $keyword->getWidth();
    $name = Node::fromJSON(
      ($json['classish_name']) as dict<_, _>,
      $file,
      $offset,
      $source,
      'Token',
    );
    $name = $name as nonnull;
    $offset += $name->getWidth();
    $type_parameters = Node::fromJSON(
      ($json['classish_type_parameters'] ?? dict['kind' => 'missing'])
        as dict<_, _>,
      $file,
      $offset,
      $source,
      'TypeParameters',
    );
    $offset += $type_parameters?->getWidth() ?? 0;
    $extends_keyword = Node::fromJSON(
      ($json['classish_extends_keyword'] ?? dict['kind' => 'missing'])
        as dict<_, _>,
      $file,
      $offset,
      $source,
      'ExtendsToken',
    );
    $offset += $extends_keyword?->getWidth() ?? 0;
    $extends_list = Node::fromJSON(
      ($json['classish_extends_list'] ?? dict['kind' => 'missing'])
        as dict<_, _>,
      $file,
      $offset,
      $source,
      'NodeList<ListItem<ISimpleCreationSpecifier>>',
    );
    $offset += $extends_list?->getWidth() ?? 0;
    $implements_keyword = Node::fromJSON(
      ($json['classish_implements_keyword'] ?? dict['kind' => 'missing'])
        as dict<_, _>,
      $file,
      $offset,
      $source,
      'ImplementsToken',
    );
    $offset += $implements_keyword?->getWidth() ?? 0;
    $implements_list = Node::fromJSON(
      ($json['classish_implements_list'] ?? dict['kind' => 'missing'])
        as dict<_, _>,
      $file,
      $offset,
      $source,
      'NodeList<ListItem<ISimpleCreationSpecifier>>',
    );
    $offset += $implements_list?->getWidth() ?? 0;
    $where_clause = Node::fromJSON(
      ($json['classish_where_clause'] ?? dict['kind' => 'missing'])
        as dict<_, _>,
      $file,
      $offset,
      $source,
      'Node',
    );
    $offset += $where_clause?->getWidth() ?? 0;
    $body = Node::fromJSON(
      ($json['classish_body']) as dict<_, _>,
      $file,
      $offset,
      $source,
      'ClassishBody',
    );
    $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] */ $attribute,
      /* HH_IGNORE_ERROR[4110] */ $modifiers,
      /* HH_IGNORE_ERROR[4110] */ $xhp,
      /* HH_IGNORE_ERROR[4110] */ $keyword,
      /* HH_IGNORE_ERROR[4110] */ $name,
      /* HH_IGNORE_ERROR[4110] */ $type_parameters,
      /* HH_IGNORE_ERROR[4110] */ $extends_keyword,
      /* HH_IGNORE_ERROR[4110] */ $extends_list,
      /* HH_IGNORE_ERROR[4110] */ $implements_keyword,
      /* HH_IGNORE_ERROR[4110] */ $implements_list,
      /* HH_IGNORE_ERROR[4110] */ $where_clause,
      /* HH_IGNORE_ERROR[4110] */ $body,
      $source_ref,
    );
  }