function constant_from_ast()

in src/consumers/constant_from_ast.hack [15:37]


function constant_from_ast(
  ConsumerContext $context,
  HHAST\ConstDeclaration $outer,
  HHAST\ConstantDeclarator $inner,
): ScannedConstant {
  return (
    new ScannedConstant(
      $inner,
      decl_name_in_context($context, name_from_ast($inner->getName())),
      context_with_node_position($context, $inner)['definitionContext'],
      doccomment_from_ast($context['definitionContext'], $inner) ??
        doccomment_from_ast($context['definitionContext'], $outer),
      value_from_ast($inner->getInitializer()?->getValue()),
      typehint_from_ast($context, $outer->getTypeSpecifier()),
      C\any(
        $outer->getModifiers()?->getChildren() ?? vec[],
        $m ==> $m is HHAST\AbstractToken,
      )
        ? AbstractnessToken::IS_ABSTRACT
        : AbstractnessToken::NOT_ABSTRACT,
    )
  );
}