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,7 @@
|
||||
using Godot;
|
||||
|
||||
public abstract partial class AbstractGenericNode<[MustBeVariant] T> : Node
|
||||
{
|
||||
[Export] // This should be included, but without type hints.
|
||||
public Godot.Collections.Array<T> MyArray { get; set; } = new();
|
||||
}
|
@@ -0,0 +1,9 @@
|
||||
using Godot;
|
||||
|
||||
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,7 @@
|
||||
using Godot;
|
||||
|
||||
public partial class AllWriteOnly : GodotObject
|
||||
{
|
||||
private bool _writeOnlyBackingField = false;
|
||||
public bool WriteOnlyProperty { set => _writeOnlyBackingField = value; }
|
||||
}
|
@@ -0,0 +1,14 @@
|
||||
using Godot;
|
||||
|
||||
public partial class Bar : GodotObject
|
||||
{
|
||||
}
|
||||
|
||||
// Foo in another file
|
||||
public partial class Foo
|
||||
{
|
||||
}
|
||||
|
||||
public partial class NotSameNameAsFile : GodotObject
|
||||
{
|
||||
}
|
@@ -0,0 +1,6 @@
|
||||
using Godot;
|
||||
|
||||
public class {|GD0001:ClassPartialModifier|} : Node
|
||||
{
|
||||
|
||||
}
|
@@ -0,0 +1,18 @@
|
||||
using Godot;
|
||||
|
||||
public partial class EventSignals : GodotObject
|
||||
{
|
||||
[Signal]
|
||||
public delegate void MySignalEventHandler(string str, int num);
|
||||
|
||||
private struct MyStruct { }
|
||||
|
||||
[Signal]
|
||||
private delegate void {|GD0201:MyInvalidSignal|}();
|
||||
|
||||
[Signal]
|
||||
private delegate void MyInvalidParameterTypeSignalEventHandler(MyStruct {|GD0202:myStruct|});
|
||||
|
||||
[Signal]
|
||||
private delegate MyStruct {|GD0203:MyInvalidReturnTypeSignalEventHandler|}();
|
||||
}
|
@@ -0,0 +1,10 @@
|
||||
using Godot;
|
||||
|
||||
public partial class ExportDiagnostics_GD0101 : Node
|
||||
{
|
||||
[Export]
|
||||
public static string {|GD0101:StaticField|};
|
||||
|
||||
[Export]
|
||||
public static int {|GD0101:StaticProperty|} { get; set; }
|
||||
}
|
@@ -0,0 +1,12 @@
|
||||
using Godot;
|
||||
|
||||
public partial class ExportDiagnostics_GD0102 : Node
|
||||
{
|
||||
public struct MyStruct { }
|
||||
|
||||
[Export]
|
||||
public MyStruct {|GD0102:StructField|};
|
||||
|
||||
[Export]
|
||||
public MyStruct {|GD0102:StructProperty|} { get; set; }
|
||||
}
|
@@ -0,0 +1,10 @@
|
||||
using Godot;
|
||||
|
||||
public partial class ExportDiagnostics_GD0103 : Node
|
||||
{
|
||||
[Export]
|
||||
public readonly string {|GD0103:ReadOnlyField|};
|
||||
|
||||
[Export]
|
||||
public string {|GD0103:ReadOnlyProperty|} { get; }
|
||||
}
|
@@ -0,0 +1,7 @@
|
||||
using Godot;
|
||||
|
||||
public partial class ExportDiagnostics_GD0104 : Node
|
||||
{
|
||||
[Export]
|
||||
public string {|GD0104:WriteOnlyProperty|} { set { } }
|
||||
}
|
@@ -0,0 +1,12 @@
|
||||
using System;
|
||||
using Godot;
|
||||
|
||||
public partial class ExportDiagnostics_GD0105 : Node
|
||||
{
|
||||
[Export]
|
||||
public int {|GD0105:this|}[int index]
|
||||
{
|
||||
get { return index; }
|
||||
set { }
|
||||
}
|
||||
}
|
@@ -0,0 +1,18 @@
|
||||
using Godot;
|
||||
|
||||
public interface MyInterface
|
||||
{
|
||||
public int MyProperty { get; set; }
|
||||
}
|
||||
|
||||
public partial class ExportDiagnostics_GD0106_OK : Node, MyInterface
|
||||
{
|
||||
[Export]
|
||||
public int MyProperty { get; set; }
|
||||
}
|
||||
|
||||
public partial class ExportDiagnostics_GD0106_KO : Node, MyInterface
|
||||
{
|
||||
[Export]
|
||||
int MyInterface.{|GD0106:MyProperty|} { get; set; }
|
||||
}
|
@@ -0,0 +1,68 @@
|
||||
using Godot;
|
||||
using Godot.Collections;
|
||||
|
||||
public partial class ExportDiagnostics_GD0107_OK : Node
|
||||
{
|
||||
[Export]
|
||||
public Node NodeField;
|
||||
|
||||
[Export]
|
||||
public Node[] SystemArrayOfNodesField;
|
||||
|
||||
[Export]
|
||||
public Array<Node> GodotArrayOfNodesField;
|
||||
|
||||
[Export]
|
||||
public Dictionary<Node, string> GodotDictionaryWithNodeAsKeyField;
|
||||
|
||||
[Export]
|
||||
public Dictionary<string, Node> GodotDictionaryWithNodeAsValueField;
|
||||
|
||||
[Export]
|
||||
public Node NodeProperty { get; set; }
|
||||
|
||||
[Export]
|
||||
public Node[] SystemArrayOfNodesProperty { get; set; }
|
||||
|
||||
[Export]
|
||||
public Array<Node> GodotArrayOfNodesProperty { get; set; }
|
||||
|
||||
[Export]
|
||||
public Dictionary<Node, string> GodotDictionaryWithNodeAsKeyProperty { get; set; }
|
||||
|
||||
[Export]
|
||||
public Dictionary<string, Node> GodotDictionaryWithNodeAsValueProperty { get; set; }
|
||||
}
|
||||
|
||||
public partial class ExportDiagnostics_GD0107_KO : Resource
|
||||
{
|
||||
[Export]
|
||||
public Node {|GD0107:NodeField|};
|
||||
|
||||
[Export]
|
||||
public Node[] {|GD0107:SystemArrayOfNodesField|};
|
||||
|
||||
[Export]
|
||||
public Array<Node> {|GD0107:GodotArrayOfNodesField|};
|
||||
|
||||
[Export]
|
||||
public Dictionary<Node, string> {|GD0107:GodotDictionaryWithNodeAsKeyField|};
|
||||
|
||||
[Export]
|
||||
public Dictionary<string, Node> {|GD0107:GodotDictionaryWithNodeAsValueField|};
|
||||
|
||||
[Export]
|
||||
public Node {|GD0107:NodeProperty|} { get; set; }
|
||||
|
||||
[Export]
|
||||
public Node[] {|GD0107:SystemArrayOfNodesProperty|} { get; set; }
|
||||
|
||||
[Export]
|
||||
public Array<Node> {|GD0107:GodotArrayOfNodesProperty|} { get; set; }
|
||||
|
||||
[Export]
|
||||
public Dictionary<Node, string> {|GD0107:GodotDictionaryWithNodeAsKeyProperty|} { get; set; }
|
||||
|
||||
[Export]
|
||||
public Dictionary<string, Node> {|GD0107:GodotDictionaryWithNodeAsValueProperty|} { get; set; }
|
||||
}
|
@@ -0,0 +1,8 @@
|
||||
using Godot;
|
||||
using Godot.Collections;
|
||||
|
||||
public partial class ExportDiagnostics_GD0108 : Node
|
||||
{
|
||||
[ExportToolButton("")]
|
||||
public Callable {|GD0108:MyButton|} => new Callable();
|
||||
}
|
@@ -0,0 +1,9 @@
|
||||
using Godot;
|
||||
using Godot.Collections;
|
||||
|
||||
[Tool]
|
||||
public partial class ExportDiagnostics_GD0109 : Node
|
||||
{
|
||||
[Export, ExportToolButton("")]
|
||||
public Callable {|GD0109:MyButton|} => new Callable();
|
||||
}
|
@@ -0,0 +1,9 @@
|
||||
using Godot;
|
||||
using Godot.Collections;
|
||||
|
||||
[Tool]
|
||||
public partial class ExportDiagnostics_GD0110 : Node
|
||||
{
|
||||
[ExportToolButton("")]
|
||||
public int {|GD0110:MyButton|} => new();
|
||||
}
|
@@ -0,0 +1,29 @@
|
||||
using Godot;
|
||||
using Godot.Collections;
|
||||
|
||||
[Tool]
|
||||
public partial class ExportDiagnostics_GD0111 : Node
|
||||
{
|
||||
private Callable _backingField;
|
||||
|
||||
[ExportToolButton("")]
|
||||
public Callable {|GD0111:MyButtonGet|} { get; }
|
||||
|
||||
[ExportToolButton("")]
|
||||
public Callable {|GD0111:MyButtonGetSet|} { get; set; }
|
||||
|
||||
[ExportToolButton("")]
|
||||
public Callable {|GD0111:MyButtonGetWithBackingField|} { get => _backingField; }
|
||||
|
||||
[ExportToolButton("")]
|
||||
public Callable {|GD0111:MyButtonGetSetWithBackingField|} { get => _backingField; set => _backingField = value; }
|
||||
|
||||
[ExportToolButton("")]
|
||||
public Callable MyButtonOkWithCallableCreationExpression => new Callable(this, "");
|
||||
|
||||
[ExportToolButton("")]
|
||||
public Callable MyButtonOkWithImplicitCallableCreationExpression => new(this, "");
|
||||
|
||||
[ExportToolButton("")]
|
||||
public Callable MyButtonOkWithCallableFromExpression => Callable.From(null);
|
||||
}
|
@@ -0,0 +1,23 @@
|
||||
using Godot;
|
||||
|
||||
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,102 @@
|
||||
using Godot;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
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_000;
|
||||
[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
|
||||
public enum MyEnum
|
||||
{
|
||||
A,
|
||||
B,
|
||||
C
|
||||
}
|
||||
|
||||
[Export] private MyEnum _fieldEnum = MyEnum.C;
|
||||
|
||||
[Flags]
|
||||
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,186 @@
|
||||
using Godot;
|
||||
using System;
|
||||
|
||||
public partial class ExportedProperties : GodotObject
|
||||
{
|
||||
// Do not generate default value
|
||||
private String _notGeneratePropertyString = new string("not generate");
|
||||
[Export]
|
||||
public String NotGenerateComplexLamdaProperty
|
||||
{
|
||||
get => _notGeneratePropertyString + Convert.ToInt32("1");
|
||||
set => _notGeneratePropertyString = value;
|
||||
}
|
||||
|
||||
[Export]
|
||||
public String NotGenerateLamdaNoFieldProperty
|
||||
{
|
||||
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 NotGenerateReturnsProperty
|
||||
{
|
||||
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 FullPropertyString_Complex
|
||||
{
|
||||
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_000;
|
||||
[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
|
||||
public enum MyEnum
|
||||
{
|
||||
A,
|
||||
B,
|
||||
C
|
||||
}
|
||||
|
||||
[Export] private MyEnum PropertyEnum { get; set; } = MyEnum.C;
|
||||
|
||||
[Flags]
|
||||
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[] field_StringNameArray { get; set; } = { "foo", "bar" };
|
||||
[Export] private NodePath[] field_NodePathArray { get; set; } = { "foo", "bar" };
|
||||
[Export] private Rid[] field_RidArray { 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,13 @@
|
||||
using Godot;
|
||||
using System;
|
||||
|
||||
[GlobalClass]
|
||||
public partial class ExportedProperties2(int health, Resource subResource, string[] strings) : Resource
|
||||
{
|
||||
[Export]
|
||||
public int Health { get; set; } = health;
|
||||
[Export]
|
||||
public Resource SubResource { get; set; } = subResource;
|
||||
[Export]
|
||||
public string[] Strings { get; set; } = strings ?? System.Array.Empty<string>();
|
||||
}
|
@@ -0,0 +1,12 @@
|
||||
using Godot;
|
||||
using System;
|
||||
|
||||
[Tool]
|
||||
public partial class ExportedToolButtons : GodotObject
|
||||
{
|
||||
[ExportToolButton("Click me!")]
|
||||
public Callable MyButton1 => Callable.From(() => { GD.Print("Clicked MyButton1!"); });
|
||||
|
||||
[ExportToolButton("Click me!", Icon = "ColorRect")]
|
||||
public Callable MyButton2 => Callable.From(() => { GD.Print("Clicked MyButton2!"); });
|
||||
}
|
@@ -0,0 +1,10 @@
|
||||
using Godot;
|
||||
|
||||
public partial class Foo : GodotObject
|
||||
{
|
||||
}
|
||||
|
||||
// Foo again in the same file
|
||||
public partial class Foo
|
||||
{
|
||||
}
|
@@ -0,0 +1,18 @@
|
||||
using Godot;
|
||||
|
||||
public partial class Generic<T> : GodotObject
|
||||
{
|
||||
private int _field;
|
||||
}
|
||||
|
||||
// Generic again but different generic parameters
|
||||
public partial class {|GD0003:Generic|}<T, R> : GodotObject
|
||||
{
|
||||
private int _field;
|
||||
}
|
||||
|
||||
// Generic again but without generic parameters
|
||||
public partial class {|GD0003:Generic|} : GodotObject
|
||||
{
|
||||
private int _field;
|
||||
}
|
@@ -0,0 +1,6 @@
|
||||
using Godot;
|
||||
|
||||
public partial class Generic<T> : GodotObject
|
||||
{
|
||||
private int _field;
|
||||
}
|
@@ -0,0 +1,22 @@
|
||||
using Godot;
|
||||
|
||||
// This works because it inherits from GodotObject.
|
||||
[GlobalClass]
|
||||
public partial class CustomGlobalClass1 : GodotObject
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
// This works because it inherits from an object that inherits from GodotObject
|
||||
[GlobalClass]
|
||||
public partial class CustomGlobalClass2 : Node
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
// This raises a GD0401 diagnostic error: global classes must inherit from GodotObject
|
||||
[GlobalClass]
|
||||
public partial class {|GD0401:CustomGlobalClass3|}
|
||||
{
|
||||
|
||||
}
|
@@ -0,0 +1,15 @@
|
||||
using Godot;
|
||||
|
||||
// This works because it inherits from GodotObject and it doesn't have any generic type parameter.
|
||||
[GlobalClass]
|
||||
public partial class CustomGlobalClass : GodotObject
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
// This raises a GD0402 diagnostic error: global classes can't have any generic type parameter
|
||||
[GlobalClass]
|
||||
public partial class {|GD0402:CustomGlobalClass|}<T> : GodotObject
|
||||
{
|
||||
|
||||
}
|
@@ -0,0 +1,8 @@
|
||||
using Godot;
|
||||
|
||||
namespace @namespace
|
||||
{
|
||||
partial class @class : GodotObject
|
||||
{
|
||||
}
|
||||
}
|
@@ -0,0 +1,26 @@
|
||||
using Godot;
|
||||
|
||||
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.
|
||||
private void MethodWithOverload(float a, float b)
|
||||
{
|
||||
}
|
||||
|
||||
// Generic methods should be ignored.
|
||||
private void GenericMethod<T>(T t)
|
||||
{
|
||||
}
|
||||
}
|
@@ -0,0 +1,12 @@
|
||||
using Godot;
|
||||
|
||||
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; }
|
||||
|
||||
bool _writeOnlyBackingField = false;
|
||||
public bool WriteOnlyProperty { set => _writeOnlyBackingField = value; }
|
||||
}
|
@@ -0,0 +1,8 @@
|
||||
using Godot;
|
||||
using System;
|
||||
|
||||
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,672 @@
|
||||
using System;
|
||||
using Godot;
|
||||
using Godot.Collections;
|
||||
using Array = Godot.Collections.Array;
|
||||
|
||||
public class MustBeVariantGD0301
|
||||
{
|
||||
public void MethodCallsError()
|
||||
{
|
||||
// This raises a GD0301 diagnostic error: object is not Variant (and Method<T> requires a variant generic type).
|
||||
Method<{|GD0301:object|}>();
|
||||
}
|
||||
|
||||
public void MethodCallsOk()
|
||||
{
|
||||
// All these calls are valid because they are Variant types.
|
||||
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[]>();
|
||||
}
|
||||
|
||||
public void MethodCallDynamic()
|
||||
{
|
||||
dynamic self = this;
|
||||
self.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<{|GD0301: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<{|GD0301:object|}>()]
|
||||
public void MethodWithWrongAttribute()
|
||||
{
|
||||
}
|
||||
|
||||
[NestedGenericTypeAttributeContainer.NestedGenericTypeAttribute<bool>()]
|
||||
public void MethodWithNestedAttribute()
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
[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<{|GD0301:object|}>()]
|
||||
public class ClassNonVariantAnnotated
|
||||
{
|
||||
}
|
||||
|
||||
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Method, AllowMultiple = true)]
|
||||
public class GenericTypeAttribute<[MustBeVariant] T> : Attribute
|
||||
{
|
||||
}
|
||||
|
||||
public class NestedGenericTypeAttributeContainer
|
||||
{
|
||||
[AttributeUsage(AttributeTargets.Method, AllowMultiple = true)]
|
||||
public class NestedGenericTypeAttribute<[MustBeVariant] T> : Attribute
|
||||
{
|
||||
}
|
||||
}
|
@@ -0,0 +1,27 @@
|
||||
using Godot;
|
||||
|
||||
public class MustBeVariantGD0302
|
||||
{
|
||||
public void MethodOk<[MustBeVariant] T>()
|
||||
{
|
||||
// T is guaranteed to be a Variant-compatible type because it's annotated with the [MustBeVariant] attribute, so it can be used here.
|
||||
new ExampleClass<T>();
|
||||
Method<T>();
|
||||
}
|
||||
|
||||
public void MethodFail<T>()
|
||||
{
|
||||
// These two calls raise a GD0302 diagnostic error: T is not valid here because it may not a Variant type and method call and class require it.
|
||||
new ExampleClass<{|GD0302:T|}>();
|
||||
Method<{|GD0302:T|}>();
|
||||
}
|
||||
|
||||
public void Method<[MustBeVariant] T>()
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
public class ExampleClass<[MustBeVariant] T>
|
||||
{
|
||||
|
||||
}
|
@@ -0,0 +1,9 @@
|
||||
using Godot;
|
||||
|
||||
public partial class GenericClass<T>
|
||||
{
|
||||
public partial class NestedClass : GodotObject
|
||||
{
|
||||
|
||||
}
|
||||
}
|
@@ -0,0 +1,11 @@
|
||||
using Godot;
|
||||
|
||||
public class {|GD0002:OuterOuterClassPartialModifierAnalyzer|}
|
||||
{
|
||||
public class {|GD0002:OuterClassPartialModifierAnalyzer|}
|
||||
{
|
||||
// MyNode is contained in a non-partial type so the source generators
|
||||
// can't enhance this type to work with Godot.
|
||||
public partial class MyNode : Node { }
|
||||
}
|
||||
}
|
@@ -0,0 +1,18 @@
|
||||
using Godot;
|
||||
|
||||
namespace NamespaceA
|
||||
{
|
||||
partial class SameName : GodotObject
|
||||
{
|
||||
private int _field;
|
||||
}
|
||||
}
|
||||
|
||||
// SameName again but different namespace
|
||||
namespace NamespaceB
|
||||
{
|
||||
partial class {|GD0003:SameName|} : GodotObject
|
||||
{
|
||||
private int _field;
|
||||
}
|
||||
}
|
@@ -0,0 +1,33 @@
|
||||
using Godot;
|
||||
|
||||
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 NestedClass : RefCounted
|
||||
{
|
||||
public override Variant _Get(StringName property) => default;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user