function attributes_from_ast()

in src/consumers/attributes_from_ast.hack [15:30]


function attributes_from_ast(
  ?HHAST\OldAttributeSpecification $node,
): dict<string, vec<mixed>> {
  if ($node === null) {
    return dict[];
  }
  return $node->getAttributes()->getChildrenOfItems()
    |> Dict\pull(
      $$,
      $attr ==> Vec\map(
        $attr->getArgumentList()?->getChildrenOfItems() ?? vec[],
        $child ==> nullthrows(value_from_ast($child))->getStaticValue(),
      ),
      $attr ==> name_from_ast($attr->getType()),
    );
}