in codegen/syntax/FunctionDeclarationHeader.hack [61:194]
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['function_modifiers'] ?? dict['kind' => 'missing']) as dict<_, _>,
$file,
$offset,
$source,
'NodeList<Token>',
);
$offset += $modifiers?->getWidth() ?? 0;
$keyword = Node::fromJSON(
($json['function_keyword']) as dict<_, _>,
$file,
$offset,
$source,
'FunctionToken',
);
$keyword = $keyword as nonnull;
$offset += $keyword->getWidth();
$name = Node::fromJSON(
($json['function_name']) as dict<_, _>,
$file,
$offset,
$source,
'Token',
);
$name = $name as nonnull;
$offset += $name->getWidth();
$type_parameter_list = Node::fromJSON(
($json['function_type_parameter_list'] ?? dict['kind' => 'missing'])
as dict<_, _>,
$file,
$offset,
$source,
'TypeParameters',
);
$offset += $type_parameter_list?->getWidth() ?? 0;
$left_paren = Node::fromJSON(
($json['function_left_paren']) as dict<_, _>,
$file,
$offset,
$source,
'LeftParenToken',
);
$left_paren = $left_paren as nonnull;
$offset += $left_paren->getWidth();
$parameter_list = Node::fromJSON(
($json['function_parameter_list'] ?? dict['kind' => 'missing'])
as dict<_, _>,
$file,
$offset,
$source,
'NodeList<ListItem<IParameter>>',
);
$offset += $parameter_list?->getWidth() ?? 0;
$right_paren = Node::fromJSON(
($json['function_right_paren']) as dict<_, _>,
$file,
$offset,
$source,
'RightParenToken',
);
$right_paren = $right_paren as nonnull;
$offset += $right_paren->getWidth();
$contexts = Node::fromJSON(
($json['function_contexts'] ?? dict['kind' => 'missing']) as dict<_, _>,
$file,
$offset,
$source,
'Contexts',
);
$offset += $contexts?->getWidth() ?? 0;
$colon = Node::fromJSON(
($json['function_colon'] ?? dict['kind' => 'missing']) as dict<_, _>,
$file,
$offset,
$source,
'ColonToken',
);
$offset += $colon?->getWidth() ?? 0;
$readonly_return = Node::fromJSON(
($json['function_readonly_return'] ?? dict['kind' => 'missing'])
as dict<_, _>,
$file,
$offset,
$source,
'ReadonlyToken',
);
$offset += $readonly_return?->getWidth() ?? 0;
$type = Node::fromJSON(
($json['function_type'] ?? dict['kind' => 'missing']) as dict<_, _>,
$file,
$offset,
$source,
'ITypeSpecifier',
);
$offset += $type?->getWidth() ?? 0;
$where_clause = Node::fromJSON(
($json['function_where_clause'] ?? dict['kind' => 'missing'])
as dict<_, _>,
$file,
$offset,
$source,
'WhereClause',
);
$offset += $where_clause?->getWidth() ?? 0;
$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] */ $keyword,
/* HH_IGNORE_ERROR[4110] */ $name,
/* HH_IGNORE_ERROR[4110] */ $type_parameter_list,
/* HH_IGNORE_ERROR[4110] */ $left_paren,
/* HH_IGNORE_ERROR[4110] */ $parameter_list,
/* HH_IGNORE_ERROR[4110] */ $right_paren,
/* HH_IGNORE_ERROR[4110] */ $contexts,
/* HH_IGNORE_ERROR[4110] */ $colon,
/* HH_IGNORE_ERROR[4110] */ $readonly_return,
/* HH_IGNORE_ERROR[4110] */ $type,
/* HH_IGNORE_ERROR[4110] */ $where_clause,
$source_ref,
);
}