Skip to content

Commit 0a5e563

Browse files
Fixing issues with getters and setters
1 parent a5cf1e8 commit 0a5e563

1 file changed

Lines changed: 5 additions & 6 deletions

File tree

src/ThunderDesign.Net-PCL.SourceGenerators/UnifiedPropertyGenerator.cs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -217,9 +217,10 @@ static string ToPropertyAccessibilityString(string access)
217217
}
218218

219219
// Helper to get the accessor modifier (empty if matches property)
220-
static string ToAccessorModifier(string accessor, string property)
220+
static string ToAccessorModifier(string accessor, string propertyAccess)
221221
{
222-
if (string.Equals(accessor, property, System.StringComparison.OrdinalIgnoreCase) || accessor == null)
222+
// Compare raw values, not formatted strings
223+
if (string.Equals(accessor, propertyAccess, System.StringComparison.OrdinalIgnoreCase) || accessor == null)
223224
return "";
224225
return ToPropertyAccessibilityString(accessor);
225226
}
@@ -240,11 +241,9 @@ static int GetAccessibilityRank(string access)
240241
}
241242

242243
// Helper to get the widest (most accessible) accessibility
243-
static string GetWidestAccessibility(object getter, object setter)
244+
static string GetWidestAccessibility(string getter, string setter)
244245
{
245-
string getterStr = getter?.ToString() ?? "Public";
246-
string setterStr = setter?.ToString() ?? "Public";
247-
return GetAccessibilityRank(getterStr) >= GetAccessibilityRank(setterStr) ? getterStr : setterStr;
246+
return GetAccessibilityRank(getter) >= GetAccessibilityRank(setter) ? getter : setter;
248247
}
249248

250249
// Generate all bindable properties

0 commit comments

Comments
 (0)