Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion MKL.NET.WrapperGenerator.Tests/GeneratorTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,10 @@ public static unsafe extern void dummy(int M, int N,

generatorResult.Generator.Should().BeSameAs(generator);
generatorResult.Diagnostics.Should().BeEmpty();
generatorResult.GeneratedSources.Should().HaveCount(1);
generatorResult.GeneratedSources.Should().ContainSingle()
.Which.SourceText.ToString().Should().Contain(
"///<remarks>" +
"This version infers the length parameter <c>N</c> from <paramref name=\"A\" />'s length.</remarks>");
generatorResult.Exception.Should().BeNull();
}

Expand Down
6 changes: 3 additions & 3 deletions MKL.NET.WrapperGenerator/WrapperGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@ public void Initialize(GeneratorInitializationContext context)
return candidates[0];
}

private static (ISet<ParameterSyntax> changed, ParameterListSyntax newList)
private static (IList<ParameterSyntax> changed, ParameterListSyntax newList)
TransformParameters(MethodDeclarationSyntax mds, Func<ParameterSyntax, ParameterSyntax?> f)
{
var changed = mds.ParameterList.Parameters.Select(ps => f(ps) is null ? null : ps).Where(ps => ps != null).ToImmutableHashSet();
var changed = mds.ParameterList.Parameters.Select(ps => f(ps) is null ? null : ps).Where(ps => ps != null).ToImmutableList();
var newList = SyntaxFactory.ParameterList(SyntaxFactory.SeparatedList(mds.ParameterList.Parameters.Select(ps => f(ps) ?? ps)));

return (changed!, newList);
Expand All @@ -57,7 +57,7 @@ private enum AdditionalTransformation

void WriterTransformedMethod(
MethodDeclarationSyntax mds, ClassDeclarationSyntax nativeCds,
(ISet<ParameterSyntax> changed, ParameterListSyntax newList) transformation, StringBuilder sb,
(IList<ParameterSyntax> changed, ParameterListSyntax newList) transformation, StringBuilder sb,
AdditionalTransformation trafo)
{
(ParameterSyntax lengthParam, string takeLengthFrom)? lengthOptions = null;
Expand Down
Loading