Skip to content

Commit 407acae

Browse files
committed
Simplify code
1 parent 9bf1427 commit 407acae

File tree

1 file changed

+4
-12
lines changed

1 file changed

+4
-12
lines changed

sources/SilkTouch/SilkTouch/Mods/MixKhronosData.cs

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1830,10 +1830,8 @@ private class Rewriter(JobData job) : CSharpSyntaxRewriter(true)
18301830
public override SyntaxNode? VisitEnumDeclaration(EnumDeclarationSyntax node)
18311831
{
18321832
var iden = node.Identifier.ToString();
1833-
if (iden.Contains("FlagBits"))
1834-
{
1835-
iden = iden.Replace("FlagBits", "Flags");
1836-
}
1833+
iden = iden.Replace("FlagBits", "Flags");
1834+
18371835
if (
18381836
job.Groups.ContainsKey(iden)
18391837
&& !node.Ancestors().OfType<BaseTypeDeclarationSyntax>().Any()
@@ -1897,10 +1895,7 @@ private class Rewriter(JobData job) : CSharpSyntaxRewriter(true)
18971895
var typeName = s.AsSpan()["const ".Length..].Trim().ToString();
18981896

18991897
// Vulkan/OpenXR enum name
1900-
if (typeName.Contains("FlagBits"))
1901-
{
1902-
typeName = typeName.Replace("FlagBits", "Flags");
1903-
}
1898+
typeName = typeName.Replace("FlagBits", "Flags");
19041899

19051900
// Remove constants that match an enum group name
19061901
// We save these constants so we can move them to the actual enum
@@ -1954,10 +1949,7 @@ internal void ReadGroups(XDocument doc, JobData data, HashSet<string> vendors)
19541949
}
19551950

19561951
// Vulkan/OpenXR enum name
1957-
if (groupName?.Contains("FlagBits") ?? false)
1958-
{
1959-
groupName = groupName.Replace("FlagBits", "Flags");
1960-
}
1952+
groupName = groupName?.Replace("FlagBits", "Flags");
19611953

19621954
// Skip Vulkan API Constants since it is not an enum
19631955
if (block.Attribute("type")?.Value == "constants")

0 commit comments

Comments
 (0)