Skip to content

Commit 44af162

Browse files
committed
Contain StripEnumMemberTypeName config option logic in a single location
1 parent da4255f commit 44af162

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

sources/ClangSharp.PInvokeGenerator/PInvokeGenerator.VisitDecl.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -295,11 +295,11 @@ private void VisitEnumConstantDecl(EnumConstantDecl enumConstantDecl)
295295
parentName = _outputBuilder.Name;
296296
}
297297

298-
var strippedName = escapedName;
299298
if (Config.StripEnumMemberTypeName)
300299
{
301300
Regex stripParentNameRegex = new($"^{Regex.Escape(parentName)}_*", RegexOptions.IgnoreCase);
302-
strippedName = stripParentNameRegex.Replace(escapedName, string.Empty);
301+
var strippedName = stripParentNameRegex.Replace(escapedName, string.Empty);
302+
escapedName = strippedName;
303303
}
304304

305305
var kind = isAnonymousEnum ? ValueKind.Primitive : ValueKind.Enumerator;
@@ -313,7 +313,7 @@ private void VisitEnumConstantDecl(EnumConstantDecl enumConstantDecl)
313313
var desc = new ValueDesc {
314314
AccessSpecifier = accessSpecifier,
315315
TypeName = typeName,
316-
EscapedName = Config.StripEnumMemberTypeName ? strippedName : escapedName,
316+
EscapedName = escapedName,
317317
NativeTypeName = null,
318318
ParentName = parentName,
319319
Kind = kind,

0 commit comments

Comments
 (0)