Skip to content

Commit 8d14e32

Browse files
committed
Use more efficient name creation and update testing framework
1 parent 174c2bb commit 8d14e32

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

sources/ClangSharp.PInvokeGenerator/PInvokeGenerator.cs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6589,12 +6589,11 @@ private bool TryRemapOperatorName(ref string name, FunctionDecl functionDecl)
65896589
}
65906590
var returnTypeName = GetRemappedTypeName(cursor: null, context: null, returnType, out _, skipUsing: true);
65916591

6592-
var pointerSuffix = "";
6593-
if (pointerIndirectionLevel > 0)
6594-
{
6595-
pointerSuffix = string.Concat(Enumerable.Repeat("Pointer", pointerIndirectionLevel));
6596-
}
6597-
name = $"To{returnTypeName}{pointerSuffix}";
6592+
name = pointerIndirectionLevel switch {
6593+
0 => $"To{returnTypeName}",
6594+
1 => $"To{returnTypeName}Pointer",
6595+
_ => $"To{returnTypeName}Pointer{pointerIndirectionLevel}"
6596+
};
65986597
return true;
65996598
}
66006599

0 commit comments

Comments
 (0)