Skip to content

Commit

Permalink
C#: Escape generated members
Browse files Browse the repository at this point in the history
  • Loading branch information
raulsntos committed Jun 15, 2024
1 parent 71699e0 commit 65cd0c8
Show file tree
Hide file tree
Showing 23 changed files with 1,042 additions and 1,041 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/static_checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
fi
echo "$files" >> changed.txt
cat changed.txt
files=$(echo "$files" | grep -v 'thirdparty' | xargs -I {} sh -c 'echo "./{}"' | tr '\n' ' ')
files=$(echo "$files" | grep -v 'thirdparty' | xargs -I {} sh -c 'echo "\"./{}\""' | tr '\n' ' ')
echo "CHANGED_FILES=$files" >> $GITHUB_ENV
# This needs to happen before Python and npm execution; it must happen before any extra files are written.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ partial class AbstractGenericNode<T>
/// <summary>
/// Cached name for the 'MyArray' property.
/// </summary>
public new static readonly global::Godot.StringName MyArray = "MyArray";
public new static readonly global::Godot.StringName @MyArray = "MyArray";
}
/// <inheritdoc/>
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
protected override bool SetGodotClassPropertyValue(in godot_string_name name, in godot_variant value)
{
if (name == PropertyName.MyArray) {
this.MyArray = global::Godot.NativeInterop.VariantUtils.ConvertToArray<T>(value);
if (name == PropertyName.@MyArray) {
this.@MyArray = global::Godot.NativeInterop.VariantUtils.ConvertToArray<T>(value);
return true;
}
return base.SetGodotClassPropertyValue(name, value);
Expand All @@ -27,8 +27,8 @@ protected override bool SetGodotClassPropertyValue(in godot_string_name name, in
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
protected override bool GetGodotClassPropertyValue(in godot_string_name name, out godot_variant value)
{
if (name == PropertyName.MyArray) {
value = global::Godot.NativeInterop.VariantUtils.CreateFromArray(this.MyArray);
if (name == PropertyName.@MyArray) {
value = global::Godot.NativeInterop.VariantUtils.CreateFromArray(this.@MyArray);
return true;
}
return base.GetGodotClassPropertyValue(name, out value);
Expand All @@ -42,7 +42,7 @@ protected override bool GetGodotClassPropertyValue(in godot_string_name name, ou
internal new static global::System.Collections.Generic.List<global::Godot.Bridge.PropertyInfo> GetGodotPropertyList()
{
var properties = new global::System.Collections.Generic.List<global::Godot.Bridge.PropertyInfo>();
properties.Add(new(type: (global::Godot.Variant.Type)28, name: PropertyName.MyArray, hint: (global::Godot.PropertyHint)0, hintString: "", usage: (global::Godot.PropertyUsageFlags)4102, exported: true));
properties.Add(new(type: (global::Godot.Variant.Type)28, name: PropertyName.@MyArray, hint: (global::Godot.PropertyHint)0, hintString: "", usage: (global::Godot.PropertyUsageFlags)4102, exported: true));
return properties;
}
#pragma warning restore CS0109
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,38 +11,38 @@ partial class AllReadOnly
/// <summary>
/// Cached name for the 'ReadOnlyAutoProperty' property.
/// </summary>
public new static readonly global::Godot.StringName ReadOnlyAutoProperty = "ReadOnlyAutoProperty";
public new static readonly global::Godot.StringName @ReadOnlyAutoProperty = "ReadOnlyAutoProperty";
/// <summary>
/// Cached name for the 'ReadOnlyProperty' property.
/// </summary>
public new static readonly global::Godot.StringName ReadOnlyProperty = "ReadOnlyProperty";
public new static readonly global::Godot.StringName @ReadOnlyProperty = "ReadOnlyProperty";
/// <summary>
/// Cached name for the 'InitOnlyAutoProperty' property.
/// </summary>
public new static readonly global::Godot.StringName InitOnlyAutoProperty = "InitOnlyAutoProperty";
public new static readonly global::Godot.StringName @InitOnlyAutoProperty = "InitOnlyAutoProperty";
/// <summary>
/// Cached name for the 'ReadOnlyField' field.
/// </summary>
public new static readonly global::Godot.StringName ReadOnlyField = "ReadOnlyField";
public new static readonly global::Godot.StringName @ReadOnlyField = "ReadOnlyField";
}
/// <inheritdoc/>
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
protected override bool GetGodotClassPropertyValue(in godot_string_name name, out godot_variant value)
{
if (name == PropertyName.ReadOnlyAutoProperty) {
value = global::Godot.NativeInterop.VariantUtils.CreateFrom<string>(this.ReadOnlyAutoProperty);
if (name == PropertyName.@ReadOnlyAutoProperty) {
value = global::Godot.NativeInterop.VariantUtils.CreateFrom<string>(this.@ReadOnlyAutoProperty);
return true;
}
if (name == PropertyName.ReadOnlyProperty) {
value = global::Godot.NativeInterop.VariantUtils.CreateFrom<string>(this.ReadOnlyProperty);
if (name == PropertyName.@ReadOnlyProperty) {
value = global::Godot.NativeInterop.VariantUtils.CreateFrom<string>(this.@ReadOnlyProperty);
return true;
}
if (name == PropertyName.InitOnlyAutoProperty) {
value = global::Godot.NativeInterop.VariantUtils.CreateFrom<string>(this.InitOnlyAutoProperty);
if (name == PropertyName.@InitOnlyAutoProperty) {
value = global::Godot.NativeInterop.VariantUtils.CreateFrom<string>(this.@InitOnlyAutoProperty);
return true;
}
if (name == PropertyName.ReadOnlyField) {
value = global::Godot.NativeInterop.VariantUtils.CreateFrom<string>(this.ReadOnlyField);
if (name == PropertyName.@ReadOnlyField) {
value = global::Godot.NativeInterop.VariantUtils.CreateFrom<string>(this.@ReadOnlyField);
return true;
}
return base.GetGodotClassPropertyValue(name, out value);
Expand All @@ -56,10 +56,10 @@ protected override bool GetGodotClassPropertyValue(in godot_string_name name, ou
internal new static global::System.Collections.Generic.List<global::Godot.Bridge.PropertyInfo> GetGodotPropertyList()
{
var properties = new global::System.Collections.Generic.List<global::Godot.Bridge.PropertyInfo>();
properties.Add(new(type: (global::Godot.Variant.Type)4, name: PropertyName.ReadOnlyField, hint: (global::Godot.PropertyHint)0, hintString: "", usage: (global::Godot.PropertyUsageFlags)4096, exported: false));
properties.Add(new(type: (global::Godot.Variant.Type)4, name: PropertyName.ReadOnlyAutoProperty, hint: (global::Godot.PropertyHint)0, hintString: "", usage: (global::Godot.PropertyUsageFlags)4096, exported: false));
properties.Add(new(type: (global::Godot.Variant.Type)4, name: PropertyName.ReadOnlyProperty, hint: (global::Godot.PropertyHint)0, hintString: "", usage: (global::Godot.PropertyUsageFlags)4096, exported: false));
properties.Add(new(type: (global::Godot.Variant.Type)4, name: PropertyName.InitOnlyAutoProperty, hint: (global::Godot.PropertyHint)0, hintString: "", usage: (global::Godot.PropertyUsageFlags)4096, exported: false));
properties.Add(new(type: (global::Godot.Variant.Type)4, name: PropertyName.@ReadOnlyField, hint: (global::Godot.PropertyHint)0, hintString: "", usage: (global::Godot.PropertyUsageFlags)4096, exported: false));
properties.Add(new(type: (global::Godot.Variant.Type)4, name: PropertyName.@ReadOnlyAutoProperty, hint: (global::Godot.PropertyHint)0, hintString: "", usage: (global::Godot.PropertyUsageFlags)4096, exported: false));
properties.Add(new(type: (global::Godot.Variant.Type)4, name: PropertyName.@ReadOnlyProperty, hint: (global::Godot.PropertyHint)0, hintString: "", usage: (global::Godot.PropertyUsageFlags)4096, exported: false));
properties.Add(new(type: (global::Godot.Variant.Type)4, name: PropertyName.@InitOnlyAutoProperty, hint: (global::Godot.PropertyHint)0, hintString: "", usage: (global::Godot.PropertyUsageFlags)4096, exported: false));
return properties;
}
#pragma warning restore CS0109
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,22 +11,22 @@ partial class AllWriteOnly
/// <summary>
/// Cached name for the 'WriteOnlyProperty' property.
/// </summary>
public new static readonly global::Godot.StringName WriteOnlyProperty = "WriteOnlyProperty";
public new static readonly global::Godot.StringName @WriteOnlyProperty = "WriteOnlyProperty";
/// <summary>
/// Cached name for the '_writeOnlyBackingField' field.
/// </summary>
public new static readonly global::Godot.StringName _writeOnlyBackingField = "_writeOnlyBackingField";
public new static readonly global::Godot.StringName @_writeOnlyBackingField = "_writeOnlyBackingField";
}
/// <inheritdoc/>
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
protected override bool SetGodotClassPropertyValue(in godot_string_name name, in godot_variant value)
{
if (name == PropertyName.WriteOnlyProperty) {
this.WriteOnlyProperty = global::Godot.NativeInterop.VariantUtils.ConvertTo<bool>(value);
if (name == PropertyName.@WriteOnlyProperty) {
this.@WriteOnlyProperty = global::Godot.NativeInterop.VariantUtils.ConvertTo<bool>(value);
return true;
}
if (name == PropertyName._writeOnlyBackingField) {
this._writeOnlyBackingField = global::Godot.NativeInterop.VariantUtils.ConvertTo<bool>(value);
if (name == PropertyName.@_writeOnlyBackingField) {
this.@_writeOnlyBackingField = global::Godot.NativeInterop.VariantUtils.ConvertTo<bool>(value);
return true;
}
return base.SetGodotClassPropertyValue(name, value);
Expand All @@ -35,8 +35,8 @@ protected override bool SetGodotClassPropertyValue(in godot_string_name name, in
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
protected override bool GetGodotClassPropertyValue(in godot_string_name name, out godot_variant value)
{
if (name == PropertyName._writeOnlyBackingField) {
value = global::Godot.NativeInterop.VariantUtils.CreateFrom<bool>(this._writeOnlyBackingField);
if (name == PropertyName.@_writeOnlyBackingField) {
value = global::Godot.NativeInterop.VariantUtils.CreateFrom<bool>(this.@_writeOnlyBackingField);
return true;
}
return base.GetGodotClassPropertyValue(name, out value);
Expand All @@ -50,8 +50,8 @@ protected override bool GetGodotClassPropertyValue(in godot_string_name name, ou
internal new static global::System.Collections.Generic.List<global::Godot.Bridge.PropertyInfo> GetGodotPropertyList()
{
var properties = new global::System.Collections.Generic.List<global::Godot.Bridge.PropertyInfo>();
properties.Add(new(type: (global::Godot.Variant.Type)1, name: PropertyName._writeOnlyBackingField, hint: (global::Godot.PropertyHint)0, hintString: "", usage: (global::Godot.PropertyUsageFlags)4096, exported: false));
properties.Add(new(type: (global::Godot.Variant.Type)1, name: PropertyName.WriteOnlyProperty, hint: (global::Godot.PropertyHint)0, hintString: "", usage: (global::Godot.PropertyUsageFlags)4096, exported: false));
properties.Add(new(type: (global::Godot.Variant.Type)1, name: PropertyName.@_writeOnlyBackingField, hint: (global::Godot.PropertyHint)0, hintString: "", usage: (global::Godot.PropertyUsageFlags)4096, exported: false));
properties.Add(new(type: (global::Godot.Variant.Type)1, name: PropertyName.@WriteOnlyProperty, hint: (global::Godot.PropertyHint)0, hintString: "", usage: (global::Godot.PropertyUsageFlags)4096, exported: false));
return properties;
}
#pragma warning restore CS0109
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ partial class EventSignals
/// <summary>
/// Cached name for the 'MySignal' signal.
/// </summary>
public new static readonly global::Godot.StringName MySignal = "MySignal";
public new static readonly global::Godot.StringName @MySignal = "MySignal";
}
/// <summary>
/// Get the signal information for all the signals declared in this class.
Expand All @@ -22,21 +22,21 @@ partial class EventSignals
internal new static global::System.Collections.Generic.List<global::Godot.Bridge.MethodInfo> GetGodotSignalList()
{
var signals = new global::System.Collections.Generic.List<global::Godot.Bridge.MethodInfo>(1);
signals.Add(new(name: SignalName.MySignal, returnVal: new(type: (global::Godot.Variant.Type)0, name: "", hint: (global::Godot.PropertyHint)0, hintString: "", usage: (global::Godot.PropertyUsageFlags)6, exported: false), flags: (global::Godot.MethodFlags)1, arguments: new() { new(type: (global::Godot.Variant.Type)4, name: "str", hint: (global::Godot.PropertyHint)0, hintString: "", usage: (global::Godot.PropertyUsageFlags)6, exported: false), new(type: (global::Godot.Variant.Type)2, name: "num", hint: (global::Godot.PropertyHint)0, hintString: "", usage: (global::Godot.PropertyUsageFlags)6, exported: false), }, defaultArguments: null));
signals.Add(new(name: SignalName.@MySignal, returnVal: new(type: (global::Godot.Variant.Type)0, name: "", hint: (global::Godot.PropertyHint)0, hintString: "", usage: (global::Godot.PropertyUsageFlags)6, exported: false), flags: (global::Godot.MethodFlags)1, arguments: new() { new(type: (global::Godot.Variant.Type)4, name: "str", hint: (global::Godot.PropertyHint)0, hintString: "", usage: (global::Godot.PropertyUsageFlags)6, exported: false), new(type: (global::Godot.Variant.Type)2, name: "num", hint: (global::Godot.PropertyHint)0, hintString: "", usage: (global::Godot.PropertyUsageFlags)6, exported: false), }, defaultArguments: null));
return signals;
}
#pragma warning restore CS0109
private global::EventSignals.MySignalEventHandler backing_MySignal;
/// <inheritdoc cref="global::EventSignals.MySignalEventHandler"/>
public event global::EventSignals.MySignalEventHandler MySignal {
public event global::EventSignals.MySignalEventHandler @MySignal {
add => backing_MySignal += value;
remove => backing_MySignal -= value;
}
/// <inheritdoc/>
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
protected override void RaiseGodotClassSignalCallbacks(in godot_string_name signal, NativeVariantPtrArgs args)
{
if (signal == SignalName.MySignal && args.Count == 2) {
if (signal == SignalName.@MySignal && args.Count == 2) {
backing_MySignal?.Invoke(global::Godot.NativeInterop.VariantUtils.ConvertTo<string>(args[0]), global::Godot.NativeInterop.VariantUtils.ConvertTo<int>(args[1]));
return;
}
Expand All @@ -46,7 +46,7 @@ protected override void RaiseGodotClassSignalCallbacks(in godot_string_name sign
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
protected override bool HasGodotClassSignal(in godot_string_name signal)
{
if (signal == SignalName.MySignal) {
if (signal == SignalName.@MySignal) {
return true;
}
return base.HasGodotClassSignal(signal);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ partial class ExportDiagnostics_GD0106_OK
{
var values = new global::System.Collections.Generic.Dictionary<global::Godot.StringName, global::Godot.Variant>(1);
int __MyProperty_default_value = default;
values.Add(PropertyName.MyProperty, global::Godot.Variant.From<int>(__MyProperty_default_value));
values.Add(PropertyName.@MyProperty, global::Godot.Variant.From<int>(__MyProperty_default_value));
return values;
}
#endif // TOOLS
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ partial class ExportDiagnostics_GD0107_OK
{
var values = new global::System.Collections.Generic.Dictionary<global::Godot.StringName, global::Godot.Variant>(2);
global::Godot.Node __NodeProperty_default_value = default;
values.Add(PropertyName.NodeProperty, global::Godot.Variant.From<global::Godot.Node>(__NodeProperty_default_value));
values.Add(PropertyName.@NodeProperty, global::Godot.Variant.From<global::Godot.Node>(__NodeProperty_default_value));
global::Godot.Node __NodeField_default_value = default;
values.Add(PropertyName.NodeField, global::Godot.Variant.From<global::Godot.Node>(__NodeField_default_value));
values.Add(PropertyName.@NodeField, global::Godot.Variant.From<global::Godot.Node>(__NodeField_default_value));
return values;
}
#endif // TOOLS
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@ partial class ExportedComplexStrings
{
var values = new global::System.Collections.Generic.Dictionary<global::Godot.StringName, global::Godot.Variant>(5);
string __PropertyInterpolated1_default_value = $"The quick brown fox jumps over {(global::Godot.GD.VarToStr($"the lazy {(global::Godot.Engine.GetVersionInfo())} do"))}g.";
values.Add(PropertyName.PropertyInterpolated1, global::Godot.Variant.From<string>(__PropertyInterpolated1_default_value));
values.Add(PropertyName.@PropertyInterpolated1, global::Godot.Variant.From<string>(__PropertyInterpolated1_default_value));
string ___fieldInterpolated1_default_value = $"The quick brown fox jumps over ({(global::Godot.Engine.GetVersionInfo())})";
values.Add(PropertyName._fieldInterpolated1, global::Godot.Variant.From<string>(___fieldInterpolated1_default_value));
values.Add(PropertyName.@_fieldInterpolated1, global::Godot.Variant.From<string>(___fieldInterpolated1_default_value));
string ___fieldInterpolated2_default_value = $"The quick brown fox jumps over ({(global::Godot.Engine.GetVersionInfo()["major"]),0:G}) the lazy dog.";
values.Add(PropertyName._fieldInterpolated2, global::Godot.Variant.From<string>(___fieldInterpolated2_default_value));
values.Add(PropertyName.@_fieldInterpolated2, global::Godot.Variant.From<string>(___fieldInterpolated2_default_value));
string ___fieldInterpolated3_default_value = $"{(((int)global::Godot.Engine.GetVersionInfo()["major"]) * -1 * -1):G} the lazy dog.";
values.Add(PropertyName._fieldInterpolated3, global::Godot.Variant.From<string>(___fieldInterpolated3_default_value));
values.Add(PropertyName.@_fieldInterpolated3, global::Godot.Variant.From<string>(___fieldInterpolated3_default_value));
string ___fieldInterpolated4_default_value = $"{(":::fff,,}<,<}},,}]")}";
values.Add(PropertyName._fieldInterpolated4, global::Godot.Variant.From<string>(___fieldInterpolated4_default_value));
values.Add(PropertyName.@_fieldInterpolated4, global::Godot.Variant.From<string>(___fieldInterpolated4_default_value));
return values;
}
#endif // TOOLS
Expand Down
Loading

0 comments on commit 65cd0c8

Please sign in to comment.