in src/consumers/shape_field_from_ast.hack [14:30]
function shape_field_from_ast(
ConsumerContext $context,
HHAST\FieldSpecifier $node,
): ScannedShapeField {
$context = context_with_node_position($context, $node);
return new ScannedShapeField(
$node,
nullthrows(value_from_ast($node->getName())),
$context['definitionContext'],
/* doccomment = */ null,
$node->getQuestion() is HHAST\QuestionToken
? OptionalityToken::IS_OPTIONAL
: OptionalityToken::IS_REQUIRED,
nullthrows(typehint_from_ast($context, $node->getType())),
);
}