GodotMemberData.cs 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. using System.Collections.Immutable;
  2. using Microsoft.CodeAnalysis;
  3. namespace Godot.SourceGenerators
  4. {
  5. public readonly struct GodotMethodData
  6. {
  7. public GodotMethodData(IMethodSymbol method, ImmutableArray<MarshalType> paramTypes,
  8. ImmutableArray<ITypeSymbol> paramTypeSymbols, MarshalType? retType, ITypeSymbol? retSymbol)
  9. {
  10. Method = method;
  11. ParamTypes = paramTypes;
  12. ParamTypeSymbols = paramTypeSymbols;
  13. RetType = retType;
  14. RetSymbol = retSymbol;
  15. }
  16. public IMethodSymbol Method { get; }
  17. public ImmutableArray<MarshalType> ParamTypes { get; }
  18. public ImmutableArray<ITypeSymbol> ParamTypeSymbols { get; }
  19. public MarshalType? RetType { get; }
  20. public ITypeSymbol? RetSymbol { get; }
  21. }
  22. public readonly struct GodotSignalDelegateData
  23. {
  24. public GodotSignalDelegateData(string name, INamedTypeSymbol delegateSymbol, GodotMethodData invokeMethodData)
  25. {
  26. Name = name;
  27. DelegateSymbol = delegateSymbol;
  28. InvokeMethodData = invokeMethodData;
  29. }
  30. public string Name { get; }
  31. public INamedTypeSymbol DelegateSymbol { get; }
  32. public GodotMethodData InvokeMethodData { get; }
  33. }
  34. public readonly struct GodotPropertyData
  35. {
  36. public GodotPropertyData(IPropertySymbol propertySymbol, MarshalType type)
  37. {
  38. PropertySymbol = propertySymbol;
  39. Type = type;
  40. }
  41. public IPropertySymbol PropertySymbol { get; }
  42. public MarshalType Type { get; }
  43. }
  44. public readonly struct GodotFieldData
  45. {
  46. public GodotFieldData(IFieldSymbol fieldSymbol, MarshalType type)
  47. {
  48. FieldSymbol = fieldSymbol;
  49. Type = type;
  50. }
  51. public IFieldSymbol FieldSymbol { get; }
  52. public MarshalType Type { get; }
  53. }
  54. public struct GodotPropertyOrFieldData
  55. {
  56. public GodotPropertyOrFieldData(ISymbol symbol, MarshalType type)
  57. {
  58. Symbol = symbol;
  59. Type = type;
  60. }
  61. public GodotPropertyOrFieldData(GodotPropertyData propertyData)
  62. : this(propertyData.PropertySymbol, propertyData.Type)
  63. {
  64. }
  65. public GodotPropertyOrFieldData(GodotFieldData fieldData)
  66. : this(fieldData.FieldSymbol, fieldData.Type)
  67. {
  68. }
  69. public ISymbol Symbol { get; }
  70. public MarshalType Type { get; }
  71. }
  72. }