Skip to content

Commit c891fcd

Browse files
committed
Add example for isSafeToTrimType and move condition to a named variable for clarity
(cherry picked from commit 87aed8e)
1 parent 12ccb9c commit c891fcd

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

sources/SilkTouch/SilkTouch/Mods/MixKhronosData.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1960,7 +1960,12 @@ public override SyntaxNode VisitEnumDeclaration(EnumDeclarationSyntax node)
19601960
var shouldTrimType = typeVendor != exclusiveVendor;
19611961

19621962
// Check if there are other versions of the enum (this includes the core variant and other vendor variants)
1963-
var isSafeToTrimType = job.Groups.Count(x => x.Key.StartsWith(typeName[..^typeVendor.Length])) <= 1;
1963+
//
1964+
// For example, SamplePatternEXT and SamplePatternSGIS are both enum types.
1965+
// Trimming both would cause conflicts.
1966+
// Trimming one but not the other would imply one is core and the other is not.
1967+
var hasMultipleVersions = job.Groups.Count(x => x.Key.StartsWith(typeName[..^typeVendor.Length])) > 1;
1968+
var isSafeToTrimType = !hasMultipleVersions;
19641969

19651970
if (shouldTrimType && isSafeToTrimType)
19661971
{

0 commit comments

Comments
 (0)