in sdk/Sdk.Generators/FunctionMetadataProviderGenerator/FunctionMetadataProviderGenerator.Parser.cs [44:90]
public IReadOnlyList<GeneratorFunctionMetadata> GetFunctionMetadataInfo(List<IMethodSymbol> methods, FunctionsMetadataParsingContext? parsingContext = null)
{
var result = ImmutableArray.CreateBuilder<GeneratorFunctionMetadata>();
// Loop through the candidate methods (methods with any attribute associated with them) which are public.
foreach (IMethodSymbol method in methods.Where(m => m.DeclaredAccessibility == Accessibility.Public))
{
CancellationToken.ThrowIfCancellationRequested();
if (!FunctionsUtil.TryGetFunctionName(method, Compilation, out var funcName))
{
_context.ReportDiagnostic(Diagnostic.Create(DiagnosticDescriptors.SymbolNotFound, Location.None, method.Name)); // would only reach here if the function attribute or method was not loaded, resulting in failure to retrieve name
}
var assemblyName = method.ContainingAssembly.Name;
var scriptFile = $"{assemblyName}{parsingContext?.ScriptFileExtension ?? ".dll"}";
var newFunction = new GeneratorFunctionMetadata
{
Name = funcName,
EntryPoint = FunctionsUtil.GetFullyQualifiedMethodName(method),
Language = Constants.Languages.DotnetIsolated,
ScriptFile = scriptFile
};
if (!TryGetBindings(method, out IList<IDictionary<string, object>>? bindings, out bool hasHttpTrigger, out GeneratorRetryOptions? retryOptions))
{
continue;
}
if (hasHttpTrigger)
{
newFunction.IsHttpTrigger = true;
}
if (retryOptions is not null)
{
newFunction.Retry = retryOptions;
}
newFunction.RawBindings = bindings!; // won't be null b/c TryGetBindings would've failed and this line wouldn't be reached
result.Add(newFunction);
}
return result;
}