Skip to content

Commit 07a0532

Browse files
committed
Add stdbool condition from BoolTransformer
Not actually sure if this is ever going to be used, but I guess it will at least be consistent in behavior with BoolTransformer
1 parent c469440 commit 07a0532

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

sources/SilkTouch/SilkTouch/Mods/TransformProperties.cs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,10 @@ private class Rewriter(Configuration config) : CSharpSyntaxRewriter
6666
// Transform bool-like fields to use MaybeBool
6767
var nativeType =
6868
node.AttributeLists.GetNativeTypeName() ?? node.Declaration.Type.ToString();
69-
if (config.BoolTypes.TryGetValue(nativeType, out var scheme))
69+
if (
70+
config.BoolTypes.TryGetValue(nativeType, out var scheme)
71+
|| (nativeType == "bool" && node.Declaration.Type.ToString().Trim() != "bool") // stdbool.h, hopefully...
72+
)
7073
{
7174
var newType = string.IsNullOrWhiteSpace(scheme)
7275
? GenericName(
@@ -94,7 +97,10 @@ private class Rewriter(Configuration config) : CSharpSyntaxRewriter
9497
{
9598
// Transform bool-like properties to use MaybeBool
9699
var nativeType = node.AttributeLists.GetNativeTypeName() ?? node.Type.ToString();
97-
if (config.BoolTypes.TryGetValue(nativeType, out var scheme))
100+
if (
101+
config.BoolTypes.TryGetValue(nativeType, out var scheme)
102+
|| (nativeType == "bool" && node.Type.ToString().Trim() != "bool") // stdbool.h, hopefully...
103+
)
98104
{
99105
var newType = string.IsNullOrWhiteSpace(scheme)
100106
? GenericName(

0 commit comments

Comments
 (0)