public static function fromJSON()

in codegen/syntax/ClosureTypeSpecifier.hack [58:184]


  public static function fromJSON(
    dict<arraykey, mixed> $json,
    string $file,
    int $initial_offset,
    string $source,
    string $_type_hint,
  ): this {
    $offset = $initial_offset;
    $outer_left_paren = Node::fromJSON(
      ($json['closure_outer_left_paren']) as dict<_, _>,
      $file,
      $offset,
      $source,
      'LeftParenToken',
    );
    $outer_left_paren = $outer_left_paren as nonnull;
    $offset += $outer_left_paren->getWidth();
    $readonly_keyword = Node::fromJSON(
      ($json['closure_readonly_keyword'] ?? dict['kind' => 'missing'])
        as dict<_, _>,
      $file,
      $offset,
      $source,
      'ReadonlyToken',
    );
    $offset += $readonly_keyword?->getWidth() ?? 0;
    $function_keyword = Node::fromJSON(
      ($json['closure_function_keyword']) as dict<_, _>,
      $file,
      $offset,
      $source,
      'FunctionToken',
    );
    $function_keyword = $function_keyword as nonnull;
    $offset += $function_keyword->getWidth();
    $inner_left_paren = Node::fromJSON(
      ($json['closure_inner_left_paren']) as dict<_, _>,
      $file,
      $offset,
      $source,
      'LeftParenToken',
    );
    $inner_left_paren = $inner_left_paren as nonnull;
    $offset += $inner_left_paren->getWidth();
    $parameter_list = Node::fromJSON(
      ($json['closure_parameter_list'] ?? dict['kind' => 'missing'])
        as dict<_, _>,
      $file,
      $offset,
      $source,
      'NodeList<ListItem<ITypeSpecifier>>',
    );
    $offset += $parameter_list?->getWidth() ?? 0;
    $inner_right_paren = Node::fromJSON(
      ($json['closure_inner_right_paren']) as dict<_, _>,
      $file,
      $offset,
      $source,
      'RightParenToken',
    );
    $inner_right_paren = $inner_right_paren as nonnull;
    $offset += $inner_right_paren->getWidth();
    $contexts = Node::fromJSON(
      ($json['closure_contexts'] ?? dict['kind' => 'missing']) as dict<_, _>,
      $file,
      $offset,
      $source,
      'Contexts',
    );
    $offset += $contexts?->getWidth() ?? 0;
    $colon = Node::fromJSON(
      ($json['closure_colon']) as dict<_, _>,
      $file,
      $offset,
      $source,
      'ColonToken',
    );
    $colon = $colon as nonnull;
    $offset += $colon->getWidth();
    $readonly_return = Node::fromJSON(
      ($json['closure_readonly_return'] ?? dict['kind' => 'missing'])
        as dict<_, _>,
      $file,
      $offset,
      $source,
      'Node',
    );
    $offset += $readonly_return?->getWidth() ?? 0;
    $return_type = Node::fromJSON(
      ($json['closure_return_type']) as dict<_, _>,
      $file,
      $offset,
      $source,
      'ITypeSpecifier',
    );
    $return_type = $return_type as nonnull;
    $offset += $return_type->getWidth();
    $outer_right_paren = Node::fromJSON(
      ($json['closure_outer_right_paren']) as dict<_, _>,
      $file,
      $offset,
      $source,
      'RightParenToken',
    );
    $outer_right_paren = $outer_right_paren as nonnull;
    $offset += $outer_right_paren->getWidth();
    $source_ref = shape(
      'file' => $file,
      'source' => $source,
      'offset' => $initial_offset,
      'width' => $offset - $initial_offset,
    );
    return new static(
      /* HH_IGNORE_ERROR[4110] */ $outer_left_paren,
      /* HH_IGNORE_ERROR[4110] */ $readonly_keyword,
      /* HH_IGNORE_ERROR[4110] */ $function_keyword,
      /* HH_IGNORE_ERROR[4110] */ $inner_left_paren,
      /* HH_IGNORE_ERROR[4110] */ $parameter_list,
      /* HH_IGNORE_ERROR[4110] */ $inner_right_paren,
      /* HH_IGNORE_ERROR[4110] */ $contexts,
      /* HH_IGNORE_ERROR[4110] */ $colon,
      /* HH_IGNORE_ERROR[4110] */ $readonly_return,
      /* HH_IGNORE_ERROR[4110] */ $return_type,
      /* HH_IGNORE_ERROR[4110] */ $outer_right_paren,
      $source_ref,
    );
  }