initial commit, 4.5 stable
Some checks failed
🔗 GHA / 📊 Static checks (push) Has been cancelled
🔗 GHA / 🤖 Android (push) Has been cancelled
🔗 GHA / 🍏 iOS (push) Has been cancelled
🔗 GHA / 🐧 Linux (push) Has been cancelled
🔗 GHA / 🍎 macOS (push) Has been cancelled
🔗 GHA / 🏁 Windows (push) Has been cancelled
🔗 GHA / 🌐 Web (push) Has been cancelled
Some checks failed
🔗 GHA / 📊 Static checks (push) Has been cancelled
🔗 GHA / 🤖 Android (push) Has been cancelled
🔗 GHA / 🍏 iOS (push) Has been cancelled
🔗 GHA / 🐧 Linux (push) Has been cancelled
🔗 GHA / 🍎 macOS (push) Has been cancelled
🔗 GHA / 🏁 Windows (push) Has been cancelled
🔗 GHA / 🌐 Web (push) Has been cancelled
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
namespace Godot.SourceGenerators.Sample
|
||||
{
|
||||
public partial class Bar : GodotObject
|
||||
{
|
||||
}
|
||||
|
||||
// Foo in another file
|
||||
public partial class Foo
|
||||
{
|
||||
}
|
||||
|
||||
public partial class NotSameNameAsFile : GodotObject
|
||||
{
|
||||
}
|
||||
}
|
@@ -0,0 +1,7 @@
|
||||
namespace Godot.SourceGenerators.Sample;
|
||||
|
||||
public partial class EventSignals : GodotObject
|
||||
{
|
||||
[Signal]
|
||||
public delegate void MySignalEventHandler(string str, int num);
|
||||
}
|
@@ -0,0 +1,26 @@
|
||||
using Godot;
|
||||
|
||||
namespace Godot.SourceGenerators.Sample
|
||||
{
|
||||
public partial class ExportedComplexStrings : Node
|
||||
{
|
||||
[Export]
|
||||
private string _fieldInterpolated1 = $"The quick brown fox jumps over ({Engine.GetVersionInfo()})";
|
||||
|
||||
[Export]
|
||||
private string _fieldInterpolated2 = $"The quick brown fox jumps over ({Engine.GetVersionInfo()["major"],0:G}) the lazy dog.";
|
||||
|
||||
[Export]
|
||||
private string _fieldInterpolated3 = $"{((int)Engine.GetVersionInfo()["major"]) * -1 * -1:G} the lazy dog.";
|
||||
|
||||
[Export]
|
||||
private string _fieldInterpolated4 = $"{":::fff,,}<,<}},,}]"}";
|
||||
|
||||
[Export]
|
||||
public string PropertyInterpolated1
|
||||
{
|
||||
get;
|
||||
private set;
|
||||
} = $"The quick brown fox jumps over {GD.VarToStr($"the lazy {Engine.GetVersionInfo()} do")}g.";
|
||||
}
|
||||
}
|
@@ -0,0 +1,118 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
|
||||
#pragma warning disable CS0169
|
||||
#pragma warning disable CS0414
|
||||
|
||||
namespace Godot.SourceGenerators.Sample
|
||||
{
|
||||
[SuppressMessage("ReSharper", "BuiltInTypeReferenceStyle")]
|
||||
[SuppressMessage("ReSharper", "RedundantNameQualifier")]
|
||||
[SuppressMessage("ReSharper", "ArrangeObjectCreationWhenTypeEvident")]
|
||||
[SuppressMessage("ReSharper", "InconsistentNaming")]
|
||||
public partial class ExportedFields : GodotObject
|
||||
{
|
||||
[Export] private Boolean _fieldBoolean = true;
|
||||
[Export] private Char _fieldChar = 'f';
|
||||
[Export] private SByte _fieldSByte = 10;
|
||||
[Export] private Int16 _fieldInt16 = 10;
|
||||
[Export] private Int32 _fieldInt32 = 10;
|
||||
[Export] private Int64 _fieldInt64 = 10;
|
||||
[Export] private Byte _fieldByte = 10;
|
||||
[Export] private UInt16 _fieldUInt16 = 10;
|
||||
[Export] private UInt32 _fieldUInt32 = 10;
|
||||
[Export] private UInt64 _fieldUInt64 = 10;
|
||||
[Export] private Single _fieldSingle = 10;
|
||||
[Export] private Double _fieldDouble = 10;
|
||||
[Export] private String _fieldString = "foo";
|
||||
|
||||
// Godot structs
|
||||
[Export] private Vector2 _fieldVector2 = new(10f, 10f);
|
||||
[Export] private Vector2I _fieldVector2I = Vector2I.Up;
|
||||
[Export] private Rect2 _fieldRect2 = new(new Vector2(10f, 10f), new Vector2(10f, 10f));
|
||||
[Export] private Rect2I _fieldRect2I = new(new Vector2I(10, 10), new Vector2I(10, 10));
|
||||
[Export] private Transform2D _fieldTransform2D = Transform2D.Identity;
|
||||
[Export] private Vector3 _fieldVector3 = new(10f, 10f, 10f);
|
||||
[Export] private Vector3I _fieldVector3I = Vector3I.Back;
|
||||
[Export] private Basis _fieldBasis = new Basis(Quaternion.Identity);
|
||||
[Export] private Quaternion _fieldQuaternion = new Quaternion(Basis.Identity);
|
||||
[Export] private Transform3D _fieldTransform3D = Transform3D.Identity;
|
||||
[Export] private Vector4 _fieldVector4 = new(10f, 10f, 10f, 10f);
|
||||
[Export] private Vector4I _fieldVector4I = Vector4I.One;
|
||||
[Export] private Projection _fieldProjection = Projection.Identity;
|
||||
[Export] private Aabb _fieldAabb = new Aabb(10f, 10f, 10f, new Vector3(1f, 1f, 1f));
|
||||
[Export] private Color _fieldColor = Colors.Aquamarine;
|
||||
[Export] private Plane _fieldPlane = Plane.PlaneXZ;
|
||||
[Export] private Callable _fieldCallable = new Callable(Engine.GetMainLoop(), "_process");
|
||||
[Export] private Signal _fieldSignal = new Signal(Engine.GetMainLoop(), "property_list_changed");
|
||||
|
||||
// Enums
|
||||
[SuppressMessage("ReSharper", "UnusedMember.Local")]
|
||||
public enum MyEnum
|
||||
{
|
||||
A,
|
||||
B,
|
||||
C
|
||||
}
|
||||
|
||||
[Export] private MyEnum _fieldEnum = MyEnum.C;
|
||||
|
||||
[Flags]
|
||||
[SuppressMessage("ReSharper", "UnusedMember.Local")]
|
||||
public enum MyFlagsEnum
|
||||
{
|
||||
A,
|
||||
B,
|
||||
C
|
||||
}
|
||||
|
||||
[Export] private MyFlagsEnum _fieldFlagsEnum = MyFlagsEnum.C;
|
||||
|
||||
// Arrays
|
||||
[Export] private Byte[] _fieldByteArray = { 0, 1, 2, 3, 4, 5, 6 };
|
||||
[Export] private Int32[] _fieldInt32Array = { 0, 1, 2, 3, 4, 5, 6 };
|
||||
[Export] private Int64[] _fieldInt64Array = { 0, 1, 2, 3, 4, 5, 6 };
|
||||
[Export] private Single[] _fieldSingleArray = { 0f, 1f, 2f, 3f, 4f, 5f, 6f };
|
||||
[Export] private Double[] _fieldDoubleArray = { 0d, 1d, 2d, 3d, 4d, 5d, 6d };
|
||||
[Export] private String[] _fieldStringArray = { "foo", "bar" };
|
||||
[Export(PropertyHint.Enum, "A,B,C")] private String[] _fieldStringArrayEnum = { "foo", "bar" };
|
||||
[Export] private Vector2[] _fieldVector2Array = { Vector2.Up, Vector2.Down, Vector2.Left, Vector2.Right };
|
||||
[Export] private Vector3[] _fieldVector3Array = { Vector3.Up, Vector3.Down, Vector3.Left, Vector3.Right };
|
||||
[Export] private Color[] _fieldColorArray = { Colors.Aqua, Colors.Aquamarine, Colors.Azure, Colors.Beige };
|
||||
[Export] private GodotObject[] _fieldGodotObjectOrDerivedArray = { null };
|
||||
[Export] private StringName[] _fieldStringNameArray = { "foo", "bar" };
|
||||
[Export] private NodePath[] _fieldNodePathArray = { "foo", "bar" };
|
||||
[Export] private Rid[] _fieldRidArray = { default, default, default };
|
||||
// Note we use Array and not System.Array. This tests the generated namespace qualification.
|
||||
[Export] private Int32[] _fieldEmptyInt32Array = Array.Empty<Int32>();
|
||||
// Note we use List and not System.Collections.Generic.
|
||||
[Export] private int[] _fieldArrayFromList = new List<int>(Array.Empty<int>()).ToArray();
|
||||
|
||||
// Variant
|
||||
[Export] private Variant _fieldVariant = "foo";
|
||||
|
||||
// Classes
|
||||
[Export] private GodotObject _fieldGodotObjectOrDerived;
|
||||
[Export] private Godot.Texture _fieldGodotResourceTexture;
|
||||
[Export] private StringName _fieldStringName = new StringName("foo");
|
||||
[Export] private NodePath _fieldNodePath = new NodePath("foo");
|
||||
[Export] private Rid _fieldRid;
|
||||
|
||||
[Export]
|
||||
private Godot.Collections.Dictionary _fieldGodotDictionary =
|
||||
new() { { "foo", 10 }, { Vector2.Up, Colors.Chocolate } };
|
||||
|
||||
[Export]
|
||||
private Godot.Collections.Array _fieldGodotArray =
|
||||
new() { "foo", 10, Vector2.Up, Colors.Chocolate };
|
||||
|
||||
[Export]
|
||||
private Godot.Collections.Dictionary<string, bool> _fieldGodotGenericDictionary =
|
||||
new() { { "foo", true }, { "bar", false } };
|
||||
|
||||
[Export]
|
||||
private Godot.Collections.Array<int> _fieldGodotGenericArray =
|
||||
new() { 0, 1, 2, 3, 4, 5, 6 };
|
||||
}
|
||||
}
|
@@ -0,0 +1,202 @@
|
||||
using System;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
|
||||
#pragma warning disable CS0169
|
||||
#pragma warning disable CS0414
|
||||
|
||||
namespace Godot.SourceGenerators.Sample
|
||||
{
|
||||
[SuppressMessage("ReSharper", "BuiltInTypeReferenceStyle")]
|
||||
[SuppressMessage("ReSharper", "RedundantNameQualifier")]
|
||||
[SuppressMessage("ReSharper", "ArrangeObjectCreationWhenTypeEvident")]
|
||||
[SuppressMessage("ReSharper", "InconsistentNaming")]
|
||||
public partial class ExportedProperties : GodotObject
|
||||
{
|
||||
// Do not generate default value
|
||||
private String _notGeneratePropertyString = new string("not generate");
|
||||
[Export]
|
||||
public String NotGenerateComplexLambdaProperty
|
||||
{
|
||||
get => _notGeneratePropertyString + Convert.ToInt32("1");
|
||||
set => _notGeneratePropertyString = value;
|
||||
}
|
||||
|
||||
[Export]
|
||||
public String NotGenerateLambdaNoFieldProperty
|
||||
{
|
||||
get => new string("not generate");
|
||||
set => _notGeneratePropertyString = value;
|
||||
}
|
||||
|
||||
[Export]
|
||||
public String NotGenerateComplexReturnProperty
|
||||
{
|
||||
get
|
||||
{
|
||||
return _notGeneratePropertyString + Convert.ToInt32("1");
|
||||
}
|
||||
set
|
||||
{
|
||||
_notGeneratePropertyString = value;
|
||||
}
|
||||
}
|
||||
|
||||
private int _notGeneratePropertyInt = 1;
|
||||
[Export]
|
||||
public string NotGenerate_Returns_Property
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_notGeneratePropertyInt == 1)
|
||||
{
|
||||
return "a";
|
||||
}
|
||||
else
|
||||
{
|
||||
return "b";
|
||||
}
|
||||
}
|
||||
set
|
||||
{
|
||||
_notGeneratePropertyInt = value == "a" ? 1 : 2;
|
||||
}
|
||||
}
|
||||
|
||||
// Full Property
|
||||
private String _fullPropertyString = "FullPropertyString";
|
||||
[Export]
|
||||
public String FullPropertyString
|
||||
{
|
||||
get
|
||||
{
|
||||
return _fullPropertyString;
|
||||
}
|
||||
set
|
||||
{
|
||||
_fullPropertyString = value;
|
||||
}
|
||||
}
|
||||
|
||||
private String _fullPropertyStringComplex = new string("FullPropertyString_Complex") + Convert.ToInt32("1");
|
||||
[Export]
|
||||
public String FullPropertyStringComplex
|
||||
{
|
||||
get
|
||||
{
|
||||
return _fullPropertyStringComplex;
|
||||
}
|
||||
set
|
||||
{
|
||||
_fullPropertyStringComplex = value;
|
||||
}
|
||||
}
|
||||
|
||||
// Lambda Property
|
||||
private String _lamdaPropertyString = "LamdaPropertyString";
|
||||
[Export]
|
||||
public String LamdaPropertyString
|
||||
{
|
||||
get => _lamdaPropertyString;
|
||||
set => _lamdaPropertyString = value;
|
||||
}
|
||||
|
||||
// Auto Property
|
||||
[Export] private Boolean PropertyBoolean { get; set; } = true;
|
||||
[Export] private Char PropertyChar { get; set; } = 'f';
|
||||
[Export] private SByte PropertySByte { get; set; } = 10;
|
||||
[Export] private Int16 PropertyInt16 { get; set; } = 10;
|
||||
[Export] private Int32 PropertyInt32 { get; set; } = 10;
|
||||
[Export] private Int64 PropertyInt64 { get; set; } = 10;
|
||||
[Export] private Byte PropertyByte { get; set; } = 10;
|
||||
[Export] private UInt16 PropertyUInt16 { get; set; } = 10;
|
||||
[Export] private UInt32 PropertyUInt32 { get; set; } = 10;
|
||||
[Export] private UInt64 PropertyUInt64 { get; set; } = 10;
|
||||
[Export] private Single PropertySingle { get; set; } = 10;
|
||||
[Export] private Double PropertyDouble { get; set; } = 10;
|
||||
[Export] private String PropertyString { get; set; } = "foo";
|
||||
|
||||
// Godot structs
|
||||
[Export] private Vector2 PropertyVector2 { get; set; } = new(10f, 10f);
|
||||
[Export] private Vector2I PropertyVector2I { get; set; } = Vector2I.Up;
|
||||
[Export] private Rect2 PropertyRect2 { get; set; } = new(new Vector2(10f, 10f), new Vector2(10f, 10f));
|
||||
[Export] private Rect2I PropertyRect2I { get; set; } = new(new Vector2I(10, 10), new Vector2I(10, 10));
|
||||
[Export] private Transform2D PropertyTransform2D { get; set; } = Transform2D.Identity;
|
||||
[Export] private Vector3 PropertyVector3 { get; set; } = new(10f, 10f, 10f);
|
||||
[Export] private Vector3I PropertyVector3I { get; set; } = Vector3I.Back;
|
||||
[Export] private Basis PropertyBasis { get; set; } = new Basis(Quaternion.Identity);
|
||||
[Export] private Quaternion PropertyQuaternion { get; set; } = new Quaternion(Basis.Identity);
|
||||
[Export] private Transform3D PropertyTransform3D { get; set; } = Transform3D.Identity;
|
||||
[Export] private Vector4 PropertyVector4 { get; set; } = new(10f, 10f, 10f, 10f);
|
||||
[Export] private Vector4I PropertyVector4I { get; set; } = Vector4I.One;
|
||||
[Export] private Projection PropertyProjection { get; set; } = Projection.Identity;
|
||||
[Export] private Aabb PropertyAabb { get; set; } = new Aabb(10f, 10f, 10f, new Vector3(1f, 1f, 1f));
|
||||
[Export] private Color PropertyColor { get; set; } = Colors.Aquamarine;
|
||||
[Export] private Plane PropertyPlane { get; set; } = Plane.PlaneXZ;
|
||||
[Export] private Callable PropertyCallable { get; set; } = new Callable(Engine.GetMainLoop(), "_process");
|
||||
[Export] private Signal PropertySignal { get; set; } = new Signal(Engine.GetMainLoop(), "Propertylist_changed");
|
||||
|
||||
// Enums
|
||||
[SuppressMessage("ReSharper", "UnusedMember.Local")]
|
||||
public enum MyEnum
|
||||
{
|
||||
A,
|
||||
B,
|
||||
C
|
||||
}
|
||||
|
||||
[Export] private MyEnum PropertyEnum { get; set; } = MyEnum.C;
|
||||
|
||||
[Flags]
|
||||
[SuppressMessage("ReSharper", "UnusedMember.Local")]
|
||||
public enum MyFlagsEnum
|
||||
{
|
||||
A,
|
||||
B,
|
||||
C
|
||||
}
|
||||
|
||||
[Export] private MyFlagsEnum PropertyFlagsEnum { get; set; } = MyFlagsEnum.C;
|
||||
|
||||
// Arrays
|
||||
[Export] private Byte[] PropertyByteArray { get; set; } = { 0, 1, 2, 3, 4, 5, 6 };
|
||||
[Export] private Int32[] PropertyInt32Array { get; set; } = { 0, 1, 2, 3, 4, 5, 6 };
|
||||
[Export] private Int64[] PropertyInt64Array { get; set; } = { 0, 1, 2, 3, 4, 5, 6 };
|
||||
[Export] private Single[] PropertySingleArray { get; set; } = { 0f, 1f, 2f, 3f, 4f, 5f, 6f };
|
||||
[Export] private Double[] PropertyDoubleArray { get; set; } = { 0d, 1d, 2d, 3d, 4d, 5d, 6d };
|
||||
[Export] private String[] PropertyStringArray { get; set; } = { "foo", "bar" };
|
||||
[Export(PropertyHint.Enum, "A,B,C")] private String[] PropertyStringArrayEnum { get; set; } = { "foo", "bar" };
|
||||
[Export] private Vector2[] PropertyVector2Array { get; set; } = { Vector2.Up, Vector2.Down, Vector2.Left, Vector2.Right };
|
||||
[Export] private Vector3[] PropertyVector3Array { get; set; } = { Vector3.Up, Vector3.Down, Vector3.Left, Vector3.Right };
|
||||
[Export] private Color[] PropertyColorArray { get; set; } = { Colors.Aqua, Colors.Aquamarine, Colors.Azure, Colors.Beige };
|
||||
[Export] private GodotObject[] PropertyGodotObjectOrDerivedArray { get; set; } = { null };
|
||||
[Export] private StringName[] PropertyStringNameArray { get; set; } = { "foo", "bar" };
|
||||
[Export] private NodePath[] PropertyNodePathArray { get; set; } = { "foo", "bar" };
|
||||
[Export] private Rid[] PropertyRidArray { get; set; } = { default, default, default };
|
||||
|
||||
// Variant
|
||||
[Export] private Variant PropertyVariant { get; set; } = "foo";
|
||||
|
||||
// Classes
|
||||
[Export] private GodotObject PropertyGodotObjectOrDerived { get; set; }
|
||||
[Export] private Godot.Texture PropertyGodotResourceTexture { get; set; }
|
||||
[Export] private StringName PropertyStringName { get; set; } = new StringName("foo");
|
||||
[Export] private NodePath PropertyNodePath { get; set; } = new NodePath("foo");
|
||||
[Export] private Rid PropertyRid { get; set; }
|
||||
|
||||
[Export]
|
||||
private Godot.Collections.Dictionary PropertyGodotDictionary { get; set; } =
|
||||
new() { { "foo", 10 }, { Vector2.Up, Colors.Chocolate } };
|
||||
|
||||
[Export]
|
||||
private Godot.Collections.Array PropertyGodotArray { get; set; } =
|
||||
new() { "foo", 10, Vector2.Up, Colors.Chocolate };
|
||||
|
||||
[Export]
|
||||
private Godot.Collections.Dictionary<string, bool> PropertyGodotGenericDictionary { get; set; } =
|
||||
new() { { "foo", true }, { "bar", false } };
|
||||
|
||||
[Export]
|
||||
private Godot.Collections.Array<int> PropertyGodotGenericArray { get; set; } =
|
||||
new() { 0, 1, 2, 3, 4, 5, 6 };
|
||||
}
|
||||
}
|
@@ -0,0 +1,11 @@
|
||||
namespace Godot.SourceGenerators.Sample
|
||||
{
|
||||
public partial class Foo : GodotObject
|
||||
{
|
||||
}
|
||||
|
||||
// Foo again in the same file
|
||||
public partial class Foo
|
||||
{
|
||||
}
|
||||
}
|
@@ -0,0 +1,10 @@
|
||||
#pragma warning disable CS0169
|
||||
|
||||
namespace Godot.SourceGenerators.Sample
|
||||
{
|
||||
// Generic again but without generic parameters
|
||||
public partial class Generic : GodotObject
|
||||
{
|
||||
private int _field;
|
||||
}
|
||||
}
|
@@ -0,0 +1,9 @@
|
||||
#pragma warning disable CS0169
|
||||
|
||||
namespace Godot.SourceGenerators.Sample
|
||||
{
|
||||
public partial class Generic1T<T> : GodotObject
|
||||
{
|
||||
private int _field;
|
||||
}
|
||||
}
|
@@ -0,0 +1,10 @@
|
||||
#pragma warning disable CS0169
|
||||
|
||||
namespace Godot.SourceGenerators.Sample
|
||||
{
|
||||
// Generic again but different generic parameters
|
||||
public partial class Generic2T<T, R> : GodotObject
|
||||
{
|
||||
private int _field;
|
||||
}
|
||||
}
|
@@ -0,0 +1,14 @@
|
||||
namespace Godot.SourceGenerators.Sample;
|
||||
|
||||
[GlobalClass]
|
||||
public partial class CustomGlobalClass : GodotObject
|
||||
{
|
||||
}
|
||||
|
||||
// This doesn't works because global classes can't have any generic type parameter.
|
||||
/*
|
||||
[GlobalClass]
|
||||
public partial class CustomGlobalClass<T> : Node
|
||||
{
|
||||
}
|
||||
*/
|
@@ -0,0 +1,35 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<LangVersion>12</LangVersion>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
<!-- $(GodotProjectDir) would normally be defined by the Godot.NET.Sdk -->
|
||||
<GodotProjectDir>$(MSBuildProjectDirectory)</GodotProjectDir>
|
||||
<GodotProjectDirBase64 Condition=" $([MSBuild]::VersionGreaterThanOrEquals($(MSBuildAssemblyVersion), '17.3')) ">$([MSBuild]::ConvertToBase64('$(GodotProjectDir)'))</GodotProjectDirBase64>
|
||||
<!-- For compiling GetGodotPropertyDefaultValues. -->
|
||||
<DefineConstants>$(DefineConstants);TOOLS</DefineConstants>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
<!-- The emitted files are not part of the compilation nor design.
|
||||
They're only for peeking at the generated sources. Sometimes the
|
||||
emitted files get corrupted, but that won't break anything. -->
|
||||
<EmitCompilerGeneratedFiles>true</EmitCompilerGeneratedFiles>
|
||||
<CompilerGeneratedFilesOutputPath>$(BaseIntermediateOutputPath)\GeneratedFiles</CompilerGeneratedFilesOutputPath>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\..\glue\GodotSharp\GodotSharp\GodotSharp.csproj">
|
||||
<Private>False</Private>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\Godot.SourceGenerators\Godot.SourceGenerators.csproj" OutputItemType="Analyzer" ReferenceOutputAssembly="false" />
|
||||
</ItemGroup>
|
||||
|
||||
<!-- This file is imported automatically when using PackageReference to
|
||||
reference Godot.SourceGenerators, but not when using ProjectReference -->
|
||||
<Import Project="..\Godot.SourceGenerators\Godot.SourceGenerators.props" />
|
||||
|
||||
</Project>
|
@@ -0,0 +1,31 @@
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
|
||||
namespace Godot.SourceGenerators.Sample;
|
||||
|
||||
[SuppressMessage("ReSharper", "RedundantNameQualifier")]
|
||||
public partial class Methods : GodotObject
|
||||
{
|
||||
private void MethodWithOverload()
|
||||
{
|
||||
}
|
||||
|
||||
private void MethodWithOverload(int a)
|
||||
{
|
||||
}
|
||||
|
||||
private void MethodWithOverload(int a, int b)
|
||||
{
|
||||
}
|
||||
|
||||
// Should be ignored. The previous one is picked.
|
||||
// ReSharper disable once UnusedMember.Local
|
||||
private void MethodWithOverload(float a, float b)
|
||||
{
|
||||
}
|
||||
|
||||
// Generic methods should be ignored.
|
||||
// ReSharper disable once UnusedMember.Local
|
||||
private void GenericMethod<T>(T t)
|
||||
{
|
||||
}
|
||||
}
|
@@ -0,0 +1,19 @@
|
||||
using System;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
|
||||
#pragma warning disable CS0169
|
||||
#pragma warning disable CS0414
|
||||
|
||||
namespace Godot.SourceGenerators.Sample
|
||||
{
|
||||
[SuppressMessage("ReSharper", "BuiltInTypeReferenceStyle")]
|
||||
[SuppressMessage("ReSharper", "RedundantNameQualifier")]
|
||||
[SuppressMessage("ReSharper", "ArrangeObjectCreationWhenTypeEvident")]
|
||||
[SuppressMessage("ReSharper", "InconsistentNaming")]
|
||||
// We split the definition of ExportedFields to verify properties work across multiple files.
|
||||
public partial class ExportedFields : GodotObject
|
||||
{
|
||||
// Note we use Array and not System.Array. This tests the generated namespace qualification.
|
||||
[Export] private Int64[] _fieldEmptyInt64Array = Array.Empty<Int64>();
|
||||
}
|
||||
}
|
@@ -0,0 +1,654 @@
|
||||
using System;
|
||||
using Godot.Collections;
|
||||
using Array = Godot.Collections.Array;
|
||||
|
||||
namespace Godot.SourceGenerators.Sample;
|
||||
|
||||
public class MustBeVariantMethods
|
||||
{
|
||||
public void MustBeVariantMethodCalls()
|
||||
{
|
||||
Method<bool>();
|
||||
Method<char>();
|
||||
Method<sbyte>();
|
||||
Method<byte>();
|
||||
Method<short>();
|
||||
Method<ushort>();
|
||||
Method<int>();
|
||||
Method<uint>();
|
||||
Method<long>();
|
||||
Method<ulong>();
|
||||
Method<float>();
|
||||
Method<double>();
|
||||
Method<string>();
|
||||
Method<Vector2>();
|
||||
Method<Vector2I>();
|
||||
Method<Rect2>();
|
||||
Method<Rect2I>();
|
||||
Method<Transform2D>();
|
||||
Method<Vector3>();
|
||||
Method<Vector3I>();
|
||||
Method<Vector4>();
|
||||
Method<Vector4I>();
|
||||
Method<Basis>();
|
||||
Method<Quaternion>();
|
||||
Method<Transform3D>();
|
||||
Method<Projection>();
|
||||
Method<Aabb>();
|
||||
Method<Color>();
|
||||
Method<Plane>();
|
||||
Method<Callable>();
|
||||
Method<Signal>();
|
||||
Method<GodotObject>();
|
||||
Method<StringName>();
|
||||
Method<NodePath>();
|
||||
Method<Rid>();
|
||||
Method<Dictionary>();
|
||||
Method<Array>();
|
||||
Method<byte[]>();
|
||||
Method<int[]>();
|
||||
Method<long[]>();
|
||||
Method<float[]>();
|
||||
Method<double[]>();
|
||||
Method<string[]>();
|
||||
Method<Vector2[]>();
|
||||
Method<Vector3[]>();
|
||||
Method<Color[]>();
|
||||
Method<GodotObject[]>();
|
||||
Method<StringName[]>();
|
||||
Method<NodePath[]>();
|
||||
Method<Rid[]>();
|
||||
|
||||
// This call fails because generic type is not Variant-compatible.
|
||||
//Method<object>();
|
||||
}
|
||||
|
||||
public void Method<[MustBeVariant] T>()
|
||||
{
|
||||
}
|
||||
|
||||
public void MustBeVariantClasses()
|
||||
{
|
||||
new ClassWithGenericVariant<bool>();
|
||||
new ClassWithGenericVariant<char>();
|
||||
new ClassWithGenericVariant<sbyte>();
|
||||
new ClassWithGenericVariant<byte>();
|
||||
new ClassWithGenericVariant<short>();
|
||||
new ClassWithGenericVariant<ushort>();
|
||||
new ClassWithGenericVariant<int>();
|
||||
new ClassWithGenericVariant<uint>();
|
||||
new ClassWithGenericVariant<long>();
|
||||
new ClassWithGenericVariant<ulong>();
|
||||
new ClassWithGenericVariant<float>();
|
||||
new ClassWithGenericVariant<double>();
|
||||
new ClassWithGenericVariant<string>();
|
||||
new ClassWithGenericVariant<Vector2>();
|
||||
new ClassWithGenericVariant<Vector2I>();
|
||||
new ClassWithGenericVariant<Rect2>();
|
||||
new ClassWithGenericVariant<Rect2I>();
|
||||
new ClassWithGenericVariant<Transform2D>();
|
||||
new ClassWithGenericVariant<Vector3>();
|
||||
new ClassWithGenericVariant<Vector3I>();
|
||||
new ClassWithGenericVariant<Vector4>();
|
||||
new ClassWithGenericVariant<Vector4I>();
|
||||
new ClassWithGenericVariant<Basis>();
|
||||
new ClassWithGenericVariant<Quaternion>();
|
||||
new ClassWithGenericVariant<Transform3D>();
|
||||
new ClassWithGenericVariant<Projection>();
|
||||
new ClassWithGenericVariant<Aabb>();
|
||||
new ClassWithGenericVariant<Color>();
|
||||
new ClassWithGenericVariant<Plane>();
|
||||
new ClassWithGenericVariant<Callable>();
|
||||
new ClassWithGenericVariant<Signal>();
|
||||
new ClassWithGenericVariant<GodotObject>();
|
||||
new ClassWithGenericVariant<StringName>();
|
||||
new ClassWithGenericVariant<NodePath>();
|
||||
new ClassWithGenericVariant<Rid>();
|
||||
new ClassWithGenericVariant<Dictionary>();
|
||||
new ClassWithGenericVariant<Array>();
|
||||
new ClassWithGenericVariant<byte[]>();
|
||||
new ClassWithGenericVariant<int[]>();
|
||||
new ClassWithGenericVariant<long[]>();
|
||||
new ClassWithGenericVariant<float[]>();
|
||||
new ClassWithGenericVariant<double[]>();
|
||||
new ClassWithGenericVariant<string[]>();
|
||||
new ClassWithGenericVariant<Vector2[]>();
|
||||
new ClassWithGenericVariant<Vector3[]>();
|
||||
new ClassWithGenericVariant<Color[]>();
|
||||
new ClassWithGenericVariant<GodotObject[]>();
|
||||
new ClassWithGenericVariant<StringName[]>();
|
||||
new ClassWithGenericVariant<NodePath[]>();
|
||||
new ClassWithGenericVariant<Rid[]>();
|
||||
|
||||
// This class fails because generic type is not Variant-compatible.
|
||||
//new ClassWithGenericVariant<object>();
|
||||
}
|
||||
}
|
||||
|
||||
public class ClassWithGenericVariant<[MustBeVariant] T>
|
||||
{
|
||||
}
|
||||
|
||||
public class MustBeVariantAnnotatedMethods
|
||||
{
|
||||
[GenericTypeAttribute<bool>()]
|
||||
public void MethodWithAttributeBool()
|
||||
{
|
||||
}
|
||||
|
||||
[GenericTypeAttribute<char>()]
|
||||
public void MethodWithAttributeChar()
|
||||
{
|
||||
}
|
||||
|
||||
[GenericTypeAttribute<sbyte>()]
|
||||
public void MethodWithAttributeSByte()
|
||||
{
|
||||
}
|
||||
|
||||
[GenericTypeAttribute<byte>()]
|
||||
public void MethodWithAttributeByte()
|
||||
{
|
||||
}
|
||||
|
||||
[GenericTypeAttribute<short>()]
|
||||
public void MethodWithAttributeInt16()
|
||||
{
|
||||
}
|
||||
|
||||
[GenericTypeAttribute<ushort>()]
|
||||
public void MethodWithAttributeUInt16()
|
||||
{
|
||||
}
|
||||
|
||||
[GenericTypeAttribute<int>()]
|
||||
public void MethodWithAttributeInt32()
|
||||
{
|
||||
}
|
||||
|
||||
[GenericTypeAttribute<uint>()]
|
||||
public void MethodWithAttributeUInt32()
|
||||
{
|
||||
}
|
||||
|
||||
[GenericTypeAttribute<long>()]
|
||||
public void MethodWithAttributeInt64()
|
||||
{
|
||||
}
|
||||
|
||||
[GenericTypeAttribute<ulong>()]
|
||||
public void MethodWithAttributeUInt64()
|
||||
{
|
||||
}
|
||||
|
||||
[GenericTypeAttribute<float>()]
|
||||
public void MethodWithAttributeSingle()
|
||||
{
|
||||
}
|
||||
|
||||
[GenericTypeAttribute<double>()]
|
||||
public void MethodWithAttributeDouble()
|
||||
{
|
||||
}
|
||||
|
||||
[GenericTypeAttribute<string>()]
|
||||
public void MethodWithAttributeString()
|
||||
{
|
||||
}
|
||||
|
||||
[GenericTypeAttribute<Vector2>()]
|
||||
public void MethodWithAttributeVector2()
|
||||
{
|
||||
}
|
||||
|
||||
[GenericTypeAttribute<Vector2I>()]
|
||||
public void MethodWithAttributeVector2I()
|
||||
{
|
||||
}
|
||||
|
||||
[GenericTypeAttribute<Rect2>()]
|
||||
public void MethodWithAttributeRect2()
|
||||
{
|
||||
}
|
||||
|
||||
[GenericTypeAttribute<Rect2I>()]
|
||||
public void MethodWithAttributeRect2I()
|
||||
{
|
||||
}
|
||||
|
||||
[GenericTypeAttribute<Transform2D>()]
|
||||
public void MethodWithAttributeTransform2D()
|
||||
{
|
||||
}
|
||||
|
||||
[GenericTypeAttribute<Vector3>()]
|
||||
public void MethodWithAttributeVector3()
|
||||
{
|
||||
}
|
||||
|
||||
[GenericTypeAttribute<Vector3I>()]
|
||||
public void MethodWithAttributeVector3I()
|
||||
{
|
||||
}
|
||||
|
||||
[GenericTypeAttribute<Vector4>()]
|
||||
public void MethodWithAttributeVector4()
|
||||
{
|
||||
}
|
||||
|
||||
[GenericTypeAttribute<Vector4I>()]
|
||||
public void MethodWithAttributeVector4I()
|
||||
{
|
||||
}
|
||||
|
||||
[GenericTypeAttribute<Basis>()]
|
||||
public void MethodWithAttributeBasis()
|
||||
{
|
||||
}
|
||||
|
||||
[GenericTypeAttribute<Quaternion>()]
|
||||
public void MethodWithAttributeQuaternion()
|
||||
{
|
||||
}
|
||||
|
||||
[GenericTypeAttribute<Transform3D>()]
|
||||
public void MethodWithAttributeTransform3D()
|
||||
{
|
||||
}
|
||||
|
||||
[GenericTypeAttribute<Projection>()]
|
||||
public void MethodWithAttributeProjection()
|
||||
{
|
||||
}
|
||||
|
||||
[GenericTypeAttribute<Aabb>()]
|
||||
public void MethodWithAttributeAabb()
|
||||
{
|
||||
}
|
||||
|
||||
[GenericTypeAttribute<Color>()]
|
||||
public void MethodWithAttributeColor()
|
||||
{
|
||||
}
|
||||
|
||||
[GenericTypeAttribute<Plane>()]
|
||||
public void MethodWithAttributePlane()
|
||||
{
|
||||
}
|
||||
|
||||
[GenericTypeAttribute<Callable>()]
|
||||
public void MethodWithAttributeCallable()
|
||||
{
|
||||
}
|
||||
|
||||
[GenericTypeAttribute<Signal>()]
|
||||
public void MethodWithAttributeSignal()
|
||||
{
|
||||
}
|
||||
|
||||
[GenericTypeAttribute<GodotObject>()]
|
||||
public void MethodWithAttributeGodotObject()
|
||||
{
|
||||
}
|
||||
|
||||
[GenericTypeAttribute<StringName>()]
|
||||
public void MethodWithAttributeStringName()
|
||||
{
|
||||
}
|
||||
|
||||
[GenericTypeAttribute<NodePath>()]
|
||||
public void MethodWithAttributeNodePath()
|
||||
{
|
||||
}
|
||||
|
||||
[GenericTypeAttribute<Rid>()]
|
||||
public void MethodWithAttributeRid()
|
||||
{
|
||||
}
|
||||
|
||||
[GenericTypeAttribute<Dictionary>()]
|
||||
public void MethodWithAttributeDictionary()
|
||||
{
|
||||
}
|
||||
|
||||
[GenericTypeAttribute<Array>()]
|
||||
public void MethodWithAttributeArray()
|
||||
{
|
||||
}
|
||||
|
||||
[GenericTypeAttribute<byte[]>()]
|
||||
public void MethodWithAttributeByteArray()
|
||||
{
|
||||
}
|
||||
|
||||
[GenericTypeAttribute<int[]>()]
|
||||
public void MethodWithAttributeInt32Array()
|
||||
{
|
||||
}
|
||||
|
||||
[GenericTypeAttribute<long[]>()]
|
||||
public void MethodWithAttributeInt64Array()
|
||||
{
|
||||
}
|
||||
|
||||
[GenericTypeAttribute<float[]>()]
|
||||
public void MethodWithAttributeSingleArray()
|
||||
{
|
||||
}
|
||||
|
||||
[GenericTypeAttribute<double[]>()]
|
||||
public void MethodWithAttributeDoubleArray()
|
||||
{
|
||||
}
|
||||
|
||||
[GenericTypeAttribute<string[]>()]
|
||||
public void MethodWithAttributeStringArray()
|
||||
{
|
||||
}
|
||||
|
||||
[GenericTypeAttribute<Vector2[]>()]
|
||||
public void MethodWithAttributeVector2Array()
|
||||
{
|
||||
}
|
||||
|
||||
[GenericTypeAttribute<Vector3[]>()]
|
||||
public void MethodWithAttributeVector3Array()
|
||||
{
|
||||
}
|
||||
|
||||
[GenericTypeAttribute<Color[]>()]
|
||||
public void MethodWithAttributeColorArray()
|
||||
{
|
||||
}
|
||||
|
||||
[GenericTypeAttribute<GodotObject[]>()]
|
||||
public void MethodWithAttributeGodotObjectArray()
|
||||
{
|
||||
}
|
||||
|
||||
[GenericTypeAttribute<StringName[]>()]
|
||||
public void MethodWithAttributeStringNameArray()
|
||||
{
|
||||
}
|
||||
|
||||
[GenericTypeAttribute<NodePath[]>()]
|
||||
public void MethodWithAttributeNodePathArray()
|
||||
{
|
||||
}
|
||||
|
||||
[GenericTypeAttribute<Rid[]>()]
|
||||
public void MethodWithAttributeRidArray()
|
||||
{
|
||||
}
|
||||
|
||||
// This method definition fails because generic type is not Variant-compatible.
|
||||
/*
|
||||
[GenericTypeAttribute<object>()]
|
||||
public void MethodWithWrongAttribute()
|
||||
{
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
[GenericTypeAttribute<bool>()]
|
||||
public class ClassVariantAnnotatedBool
|
||||
{
|
||||
}
|
||||
|
||||
[GenericTypeAttribute<char>()]
|
||||
public class ClassVariantAnnotatedChar
|
||||
{
|
||||
}
|
||||
|
||||
[GenericTypeAttribute<sbyte>()]
|
||||
public class ClassVariantAnnotatedSByte
|
||||
{
|
||||
}
|
||||
|
||||
[GenericTypeAttribute<byte>()]
|
||||
public class ClassVariantAnnotatedByte
|
||||
{
|
||||
}
|
||||
|
||||
[GenericTypeAttribute<short>()]
|
||||
public class ClassVariantAnnotatedInt16
|
||||
{
|
||||
}
|
||||
|
||||
[GenericTypeAttribute<ushort>()]
|
||||
public class ClassVariantAnnotatedUInt16
|
||||
{
|
||||
}
|
||||
|
||||
[GenericTypeAttribute<int>()]
|
||||
public class ClassVariantAnnotatedInt32
|
||||
{
|
||||
}
|
||||
|
||||
[GenericTypeAttribute<uint>()]
|
||||
public class ClassVariantAnnotatedUInt32
|
||||
{
|
||||
}
|
||||
|
||||
[GenericTypeAttribute<long>()]
|
||||
public class ClassVariantAnnotatedInt64
|
||||
{
|
||||
}
|
||||
|
||||
[GenericTypeAttribute<ulong>()]
|
||||
public class ClassVariantAnnotatedUInt64
|
||||
{
|
||||
}
|
||||
|
||||
[GenericTypeAttribute<float>()]
|
||||
public class ClassVariantAnnotatedSingle
|
||||
{
|
||||
}
|
||||
|
||||
[GenericTypeAttribute<double>()]
|
||||
public class ClassVariantAnnotatedDouble
|
||||
{
|
||||
}
|
||||
|
||||
[GenericTypeAttribute<string>()]
|
||||
public class ClassVariantAnnotatedString
|
||||
{
|
||||
}
|
||||
|
||||
[GenericTypeAttribute<Vector2>()]
|
||||
public class ClassVariantAnnotatedVector2
|
||||
{
|
||||
}
|
||||
|
||||
[GenericTypeAttribute<Vector2I>()]
|
||||
public class ClassVariantAnnotatedVector2I
|
||||
{
|
||||
}
|
||||
|
||||
[GenericTypeAttribute<Rect2>()]
|
||||
public class ClassVariantAnnotatedRect2
|
||||
{
|
||||
}
|
||||
|
||||
[GenericTypeAttribute<Rect2I>()]
|
||||
public class ClassVariantAnnotatedRect2I
|
||||
{
|
||||
}
|
||||
|
||||
[GenericTypeAttribute<Transform2D>()]
|
||||
public class ClassVariantAnnotatedTransform2D
|
||||
{
|
||||
}
|
||||
|
||||
[GenericTypeAttribute<Vector3>()]
|
||||
public class ClassVariantAnnotatedVector3
|
||||
{
|
||||
}
|
||||
|
||||
[GenericTypeAttribute<Vector3I>()]
|
||||
public class ClassVariantAnnotatedVector3I
|
||||
{
|
||||
}
|
||||
|
||||
[GenericTypeAttribute<Vector4>()]
|
||||
public class ClassVariantAnnotatedVector4
|
||||
{
|
||||
}
|
||||
|
||||
[GenericTypeAttribute<Vector4I>()]
|
||||
public class ClassVariantAnnotatedVector4I
|
||||
{
|
||||
}
|
||||
|
||||
[GenericTypeAttribute<Basis>()]
|
||||
public class ClassVariantAnnotatedBasis
|
||||
{
|
||||
}
|
||||
|
||||
[GenericTypeAttribute<Quaternion>()]
|
||||
public class ClassVariantAnnotatedQuaternion
|
||||
{
|
||||
}
|
||||
|
||||
[GenericTypeAttribute<Transform3D>()]
|
||||
public class ClassVariantAnnotatedTransform3D
|
||||
{
|
||||
}
|
||||
|
||||
[GenericTypeAttribute<Projection>()]
|
||||
public class ClassVariantAnnotatedProjection
|
||||
{
|
||||
}
|
||||
|
||||
[GenericTypeAttribute<Aabb>()]
|
||||
public class ClassVariantAnnotatedAabb
|
||||
{
|
||||
}
|
||||
|
||||
[GenericTypeAttribute<Color>()]
|
||||
public class ClassVariantAnnotatedColor
|
||||
{
|
||||
}
|
||||
|
||||
[GenericTypeAttribute<Plane>()]
|
||||
public class ClassVariantAnnotatedPlane
|
||||
{
|
||||
}
|
||||
|
||||
[GenericTypeAttribute<Callable>()]
|
||||
public class ClassVariantAnnotatedCallable
|
||||
{
|
||||
}
|
||||
|
||||
[GenericTypeAttribute<Signal>()]
|
||||
public class ClassVariantAnnotatedSignal
|
||||
{
|
||||
}
|
||||
|
||||
[GenericTypeAttribute<GodotObject>()]
|
||||
public class ClassVariantAnnotatedGodotObject
|
||||
{
|
||||
}
|
||||
|
||||
[GenericTypeAttribute<StringName>()]
|
||||
public class ClassVariantAnnotatedStringName
|
||||
{
|
||||
}
|
||||
|
||||
[GenericTypeAttribute<NodePath>()]
|
||||
public class ClassVariantAnnotatedNodePath
|
||||
{
|
||||
}
|
||||
|
||||
[GenericTypeAttribute<Rid>()]
|
||||
public class ClassVariantAnnotatedRid
|
||||
{
|
||||
}
|
||||
|
||||
[GenericTypeAttribute<Dictionary>()]
|
||||
public class ClassVariantAnnotatedDictionary
|
||||
{
|
||||
}
|
||||
|
||||
[GenericTypeAttribute<Array>()]
|
||||
public class ClassVariantAnnotatedArray
|
||||
{
|
||||
}
|
||||
|
||||
[GenericTypeAttribute<byte[]>()]
|
||||
public class ClassVariantAnnotatedByteArray
|
||||
{
|
||||
}
|
||||
|
||||
[GenericTypeAttribute<int[]>()]
|
||||
public class ClassVariantAnnotatedInt32Array
|
||||
{
|
||||
}
|
||||
|
||||
[GenericTypeAttribute<long[]>()]
|
||||
public class ClassVariantAnnotatedInt64Array
|
||||
{
|
||||
}
|
||||
|
||||
[GenericTypeAttribute<float[]>()]
|
||||
public class ClassVariantAnnotatedSingleArray
|
||||
{
|
||||
}
|
||||
|
||||
[GenericTypeAttribute<double[]>()]
|
||||
public class ClassVariantAnnotatedDoubleArray
|
||||
{
|
||||
}
|
||||
|
||||
[GenericTypeAttribute<string[]>()]
|
||||
public class ClassVariantAnnotatedStringArray
|
||||
{
|
||||
}
|
||||
|
||||
[GenericTypeAttribute<Vector2[]>()]
|
||||
public class ClassVariantAnnotatedVector2Array
|
||||
{
|
||||
}
|
||||
|
||||
[GenericTypeAttribute<Vector3[]>()]
|
||||
public class ClassVariantAnnotatedVector3Array
|
||||
{
|
||||
}
|
||||
|
||||
[GenericTypeAttribute<Color[]>()]
|
||||
public class ClassVariantAnnotatedColorArray
|
||||
{
|
||||
}
|
||||
|
||||
[GenericTypeAttribute<GodotObject[]>()]
|
||||
public class ClassVariantAnnotatedGodotObjectArray
|
||||
{
|
||||
}
|
||||
|
||||
[GenericTypeAttribute<StringName[]>()]
|
||||
public class ClassVariantAnnotatedStringNameArray
|
||||
{
|
||||
}
|
||||
|
||||
[GenericTypeAttribute<NodePath[]>()]
|
||||
public class ClassVariantAnnotatedNodePathArray
|
||||
{
|
||||
}
|
||||
|
||||
[GenericTypeAttribute<Rid[]>()]
|
||||
public class ClassVariantAnnotatedRidArray
|
||||
{
|
||||
}
|
||||
|
||||
// This class definition fails because generic type is not Variant-compatible.
|
||||
/*
|
||||
[GenericTypeAttribute<object>()]
|
||||
public class ClassNonVariantAnnotated
|
||||
{
|
||||
}
|
||||
*/
|
||||
|
||||
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Method, AllowMultiple = true)]
|
||||
public class GenericTypeAttribute<[MustBeVariant] T> : Attribute
|
||||
{
|
||||
}
|
@@ -0,0 +1,22 @@
|
||||
using System;
|
||||
|
||||
namespace Godot.SourceGenerators.Sample;
|
||||
|
||||
public partial class NestedClass : GodotObject
|
||||
{
|
||||
public partial class NestedClass2 : GodotObject
|
||||
{
|
||||
public partial class NestedClass3 : GodotObject
|
||||
{
|
||||
[Signal]
|
||||
public delegate void MySignalEventHandler(string str, int num);
|
||||
|
||||
[Export] private String _fieldString = "foo";
|
||||
[Export] private String PropertyString { get; set; } = "foo";
|
||||
|
||||
private void Method()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,10 @@
|
||||
namespace Godot.SourceGenerators.Sample
|
||||
{
|
||||
public partial class AllReadOnly : GodotObject
|
||||
{
|
||||
public readonly string ReadonlyField = "foo";
|
||||
public string ReadonlyAutoProperty { get; } = "foo";
|
||||
public string ReadonlyProperty { get => "foo"; }
|
||||
public string InitonlyAutoProperty { get; init; }
|
||||
}
|
||||
}
|
@@ -0,0 +1,10 @@
|
||||
using System;
|
||||
|
||||
namespace Godot.SourceGenerators.Sample
|
||||
{
|
||||
public partial class AllWriteOnly : GodotObject
|
||||
{
|
||||
private bool _writeOnlyBackingField = false;
|
||||
public bool WriteOnlyProperty { set => _writeOnlyBackingField = value; }
|
||||
}
|
||||
}
|
@@ -0,0 +1,13 @@
|
||||
namespace Godot.SourceGenerators.Sample
|
||||
{
|
||||
public partial class MixedReadonlyWriteOnly : GodotObject
|
||||
{
|
||||
public readonly string ReadOnlyField = "foo";
|
||||
public string ReadOnlyAutoProperty { get; } = "foo";
|
||||
public string ReadOnlyProperty { get => "foo"; }
|
||||
public string InitOnlyAutoProperty { get; init; }
|
||||
|
||||
private bool _writeOnlyBackingField = false;
|
||||
public bool WriteOnlyProperty { set => _writeOnlyBackingField = value; }
|
||||
}
|
||||
}
|
@@ -0,0 +1,36 @@
|
||||
#pragma warning disable CS0169
|
||||
|
||||
namespace Godot.SourceGenerators.Sample
|
||||
{
|
||||
public partial class ScriptBoilerplate : Node
|
||||
{
|
||||
private NodePath _nodePath;
|
||||
private int _velocity;
|
||||
|
||||
public override void _Process(double delta)
|
||||
{
|
||||
_ = delta;
|
||||
|
||||
base._Process(delta);
|
||||
}
|
||||
|
||||
public int Bazz(StringName name)
|
||||
{
|
||||
_ = name;
|
||||
return 1;
|
||||
}
|
||||
|
||||
public void IgnoreThisMethodWithByRefParams(ref int a)
|
||||
{
|
||||
_ = a;
|
||||
}
|
||||
}
|
||||
|
||||
public partial struct OuterClass
|
||||
{
|
||||
public partial class NesterClass : RefCounted
|
||||
{
|
||||
public override Variant _Get(StringName property) => default;
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user