Skip to content

Commit

Permalink
Make generated code use the same style as godot-cpp
Browse files Browse the repository at this point in the history
  • Loading branch information
chocola-mint committed Nov 16, 2023
1 parent 08740af commit fa3b114
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions source/RegAutomation/RegAutomation.Core/PropertyBinder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -63,17 +63,14 @@ public static (string propertyBindings, string functionBindings, string function
if(propertyReferenceType is PropertyReferenceType.Ref)
propertyType = $"Ref<{propertyType}>";
// For pointers, we insert the pointer asterisk back into the function declarations.
// We can't put this on propertyType because the asterisk is placed right next to the type for the getter,
// but right next to the parameter for the setter.
string pointerSymbol;
if (propertyReferenceType is PropertyReferenceType.Pointer)
pointerSymbol = "*";
propertyType = $"{propertyType} *";
else
pointerSymbol = "";
propertyType = $"{propertyType} ";

// Finally, construct the getters and setters.
string genGetterDeclaration = $"\t{propertyType}{pointerSymbol} _gen_{getter}() const {{ return {propertyName}; }}\n";
string genSetterDeclaration = $"\tvoid _gen_{setter}({propertyType} {pointerSymbol}p) {{ {propertyName} = p; }}\n";
string genGetterDeclaration = $"\t{propertyType}_gen_{getter}() const {{ return {propertyName}; }}\n";
string genSetterDeclaration = $"\tvoid _gen_{setter}({propertyType}p) {{ {propertyName} = p; }}\n";

return new (
addPropertyStatement,
Expand Down

0 comments on commit fa3b114

Please sign in to comment.