Skip to content

Commit db416dd

Browse files
Still testing getter and setter
1 parent ed6ee11 commit db416dd

1 file changed

Lines changed: 10 additions & 11 deletions

File tree

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

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -217,10 +217,9 @@ 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 propertyAccess)
220+
static string ToAccessorModifier(string accessor, string propertyRaw)
221221
{
222-
// Compare raw values, not formatted strings
223-
if (string.Equals(accessor, propertyAccess, System.StringComparison.OrdinalIgnoreCase) || accessor == null)
222+
if (string.Equals(accessor, propertyRaw, System.StringComparison.OrdinalIgnoreCase) || accessor == null)
224223
return "";
225224
return ToPropertyAccessibilityString(accessor);
226225
}
@@ -286,10 +285,10 @@ static string GetWidestAccessibility(string getter, string setter)
286285
// Get string values for getter/setter, defaulting to "Public"
287286
string getterValue = (getter ?? "Public").ToString();
288287
string setterValue = (setter ?? "Public").ToString();
289-
string propertyAccess = GetWidestAccessibility(getterValue, setterValue);
290-
string propertyAccessibilityStr = ToPropertyAccessibilityString(propertyAccess);
291-
string getterStr = ToAccessorModifier(getterValue, propertyAccess);
292-
string setterStr = ToAccessorModifier(setterValue, propertyAccess);
288+
string propertyAccessRaw = GetWidestAccessibility(getterValue, setterValue); // e.g., "Public"
289+
string propertyAccessibilityStr = ToPropertyAccessibilityString(propertyAccessRaw); // e.g., "public "
290+
string getterStr = ToAccessorModifier(getterValue, propertyAccessRaw); // e.g., "" if getter is "Public"
291+
string setterStr = ToAccessorModifier(setterValue, propertyAccessRaw); // e.g., "private " if setter is "Private"
293292

294293
var lockerArg = threadSafe ? "_Locker" : "null";
295294
var notifyArg = notify ? "true" : "false";
@@ -359,10 +358,10 @@ static string GetWidestAccessibility(string getter, string setter)
359358
// Get string values for getter/setter, defaulting to "Public"
360359
string getterValue = (getter ?? "Public").ToString();
361360
string setterValue = (setter ?? "Public").ToString();
362-
string propertyAccess = GetWidestAccessibility(getterValue, setterValue);
363-
string propertyAccessibilityStr = ToPropertyAccessibilityString(propertyAccess);
364-
string getterStr = ToAccessorModifier(getterValue, propertyAccess);
365-
string setterStr = ToAccessorModifier(setterValue, propertyAccess);
361+
string propertyAccessRaw = GetWidestAccessibility(getterValue, setterValue); // e.g., "Public"
362+
string propertyAccessibilityStr = ToPropertyAccessibilityString(propertyAccessRaw); // e.g., "public "
363+
string getterStr = ToAccessorModifier(getterValue, propertyAccessRaw); // e.g., "" if getter is "Public"
364+
string setterStr = ToAccessorModifier(setterValue, propertyAccessRaw); // e.g., "private " if setter is "Private"
366365

367366
var lockerArg = threadSafe ? "_Locker" : "null";
368367
if (readOnly)

0 commit comments

Comments
 (0)