public static function fromJSON()

in codegen/syntax/ContextConstDeclaration.hack [54:160]


  public static function fromJSON(
    dict<arraykey, mixed> $json,
    string $file,
    int $initial_offset,
    string $source,
    string $_type_hint,
  ): this {
    $offset = $initial_offset;
    $modifiers = Node::fromJSON(
      ($json['context_const_modifiers'] ?? dict['kind' => 'missing'])
        as dict<_, _>,
      $file,
      $offset,
      $source,
      'NodeList<AbstractToken>',
    );
    $offset += $modifiers?->getWidth() ?? 0;
    $const_keyword = Node::fromJSON(
      ($json['context_const_const_keyword']) as dict<_, _>,
      $file,
      $offset,
      $source,
      'ConstToken',
    );
    $const_keyword = $const_keyword as nonnull;
    $offset += $const_keyword->getWidth();
    $ctx_keyword = Node::fromJSON(
      ($json['context_const_ctx_keyword']) as dict<_, _>,
      $file,
      $offset,
      $source,
      'CtxToken',
    );
    $ctx_keyword = $ctx_keyword as nonnull;
    $offset += $ctx_keyword->getWidth();
    $name = Node::fromJSON(
      ($json['context_const_name']) as dict<_, _>,
      $file,
      $offset,
      $source,
      'NameToken',
    );
    $name = $name as nonnull;
    $offset += $name->getWidth();
    $type_parameters = Node::fromJSON(
      ($json['context_const_type_parameters'] ?? dict['kind' => 'missing'])
        as dict<_, _>,
      $file,
      $offset,
      $source,
      'Node',
    );
    $offset += $type_parameters?->getWidth() ?? 0;
    $constraint = Node::fromJSON(
      ($json['context_const_constraint'] ?? dict['kind' => 'missing'])
        as dict<_, _>,
      $file,
      $offset,
      $source,
      'NodeList<ContextConstraint>',
    );
    $offset += $constraint?->getWidth() ?? 0;
    $equal = Node::fromJSON(
      ($json['context_const_equal'] ?? dict['kind' => 'missing']) as dict<_, _>,
      $file,
      $offset,
      $source,
      'EqualToken',
    );
    $offset += $equal?->getWidth() ?? 0;
    $ctx_list = Node::fromJSON(
      ($json['context_const_ctx_list'] ?? dict['kind' => 'missing'])
        as dict<_, _>,
      $file,
      $offset,
      $source,
      'Contexts',
    );
    $offset += $ctx_list?->getWidth() ?? 0;
    $semicolon = Node::fromJSON(
      ($json['context_const_semicolon']) as dict<_, _>,
      $file,
      $offset,
      $source,
      'SemicolonToken',
    );
    $semicolon = $semicolon as nonnull;
    $offset += $semicolon->getWidth();
    $source_ref = shape(
      'file' => $file,
      'source' => $source,
      'offset' => $initial_offset,
      'width' => $offset - $initial_offset,
    );
    return new static(
      /* HH_IGNORE_ERROR[4110] */ $modifiers,
      /* HH_IGNORE_ERROR[4110] */ $const_keyword,
      /* HH_IGNORE_ERROR[4110] */ $ctx_keyword,
      /* HH_IGNORE_ERROR[4110] */ $name,
      /* HH_IGNORE_ERROR[4110] */ $type_parameters,
      /* HH_IGNORE_ERROR[4110] */ $constraint,
      /* HH_IGNORE_ERROR[4110] */ $equal,
      /* HH_IGNORE_ERROR[4110] */ $ctx_list,
      /* HH_IGNORE_ERROR[4110] */ $semicolon,
      $source_ref,
    );
  }