Skip to content

Commit bc4e19e

Browse files
committed
Minor changes.
1 parent 788e30e commit bc4e19e

File tree

4 files changed

+6
-4
lines changed

4 files changed

+6
-4
lines changed

src/UnityUxmlGenerator/Extensions/StringExtensions.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ namespace UnityUxmlGenerator.Extensions;
44

55
internal static class StringExtensions
66
{
7-
public static string ToFieldName(this string propertyName)
7+
public static string ToPrivateFieldName(this string propertyName)
88
{
9-
return string.Concat(char.ToLower(propertyName[0]), propertyName.Substring(1));
9+
return string.Concat("_", char.ToLower(propertyName[0]), propertyName.Substring(1));
1010
}
1111

1212
public static string ToDashCase(this string propertyName)

src/UnityUxmlGenerator/UxmlGenerator.Traits.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ private static string GetUxmlTraitsFields(List<(string, string?)> properties)
6565
foreach (var (propertyName, uxmlAttributeDefaultValue) in properties)
6666
{
6767
var attributeUxmlName = propertyName.ToDashCase();
68-
var attributeFieldName = propertyName.ToFieldName();
68+
var attributeFieldName = propertyName.ToPrivateFieldName();
6969
var attributeDefaultValue = uxmlAttributeDefaultValue ?? string.Empty;
7070

7171
stringBuilder.AppendLine($"\t\t\t{GeneratedCodeAttribute}");
@@ -86,7 +86,7 @@ private static string GetUxmlTraitsInitialization(string elementClassName,
8686

8787
foreach (var (propertyName, _) in properties)
8888
{
89-
var attributeFieldName = propertyName.ToFieldName();
89+
var attributeFieldName = propertyName.ToPrivateFieldName();
9090

9191
stringBuilder.AppendLine(
9292
$"\t\t\t\tcontrol.{propertyName} = {attributeFieldName}.GetValueFromBag(bag, context);");

src/UnityUxmlGenerator/UxmlGenerator.cs

+2
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44

55
namespace UnityUxmlGenerator;
66

7+
// TODO: Use a syntax tree API to generate source code.
8+
79
[Generator]
810
internal sealed partial class UxmlGenerator : ISourceGenerator
911
{

0 commit comments

Comments
 (0)