-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathCodeBuildingHelpers.cs
More file actions
35 lines (31 loc) · 1.17 KB
/
CodeBuildingHelpers.cs
File metadata and controls
35 lines (31 loc) · 1.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
using M31.FluentApi.Generator.CodeBuilding;
using M31.FluentApi.Generator.CodeGeneration.CodeBoardElements;
using M31.FluentApi.Generator.SourceGenerators.Generics;
namespace M31.FluentApi.Generator.CodeGeneration.CodeBoardActors.Commons;
internal static class CodeBuildingHelpers
{
internal static void AddGenericParameters(MethodSignature methodSignature, GenericInfo? genericInfo)
{
if (genericInfo == null)
{
return;
}
foreach (GenericTypeParameter genericTypeParameter in genericInfo.Parameters)
{
methodSignature.AddGenericParameter(
genericTypeParameter.ParameterName,
genericTypeParameter.Constraints.GetConstraintsForCodeGeneration());
}
}
internal static List<Parameter> CreateParameters(IReadOnlyCollection<ParameterSymbolInfo> parameterInfos)
{
return parameterInfos
.Select(i => new Parameter(
i.TypeForCodeGeneration,
i.ParameterName,
i.DefaultValue,
i.GenericTypeParameterPosition,
new ParameterAnnotations(i.ParameterKinds)))
.ToList();
}
}