member_info_inheritance.gd 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. # GH-82169
  2. @warning_ignore_start("unused_signal")
  3. @abstract class A:
  4. @abstract func test_abstract_func_1()
  5. @abstract func test_abstract_func_2()
  6. func test_override_func_1(): pass
  7. func test_override_func_2(): pass
  8. class B extends A:
  9. static var test_static_var_b1
  10. static var test_static_var_b2
  11. var test_var_b1
  12. var test_var_b2
  13. static func test_static_func_b1(): pass
  14. static func test_static_func_b2(): pass
  15. func test_abstract_func_1(): pass
  16. func test_abstract_func_2(): pass
  17. func test_override_func_1(): pass
  18. func test_override_func_2(): pass
  19. func test_func_b1(): pass
  20. func test_func_b2(): pass
  21. signal test_signal_b1()
  22. signal test_signal_b2()
  23. class C extends B:
  24. static var test_static_var_c1
  25. static var test_static_var_c2
  26. var test_var_c1
  27. var test_var_c2
  28. static func test_static_func_c1(): pass
  29. static func test_static_func_c2(): pass
  30. func test_abstract_func_1(): pass
  31. func test_abstract_func_2(): pass
  32. func test_override_func_1(): pass
  33. func test_override_func_2(): pass
  34. func test_func_c1(): pass
  35. func test_func_c2(): pass
  36. signal test_signal_c1()
  37. signal test_signal_c2()
  38. func test_property_signature(name: String, base: Object, is_static: bool = false) -> void:
  39. prints("---", name, "---")
  40. for property in base.get_property_list():
  41. if str(property.name).begins_with("test_"):
  42. print(Utils.get_property_signature(property, null, is_static))
  43. func test_method_signature(name: String, base: Object) -> void:
  44. prints("---", name, "---")
  45. for method in base.get_method_list():
  46. if str(method.name).begins_with("test_"):
  47. print(Utils.get_method_signature(method))
  48. func test_signal_signature(name: String, base: Object) -> void:
  49. prints("---", name, "---")
  50. for method in base.get_signal_list():
  51. if str(method.name).begins_with("test_"):
  52. print(Utils.get_method_signature(method, true))
  53. func test():
  54. var b := B.new()
  55. var c := C.new()
  56. print("=== Class Properties ===")
  57. test_property_signature("A", A as GDScript, true)
  58. test_property_signature("B", B as GDScript, true)
  59. test_property_signature("C", C as GDScript, true)
  60. print("=== Member Properties ===")
  61. test_property_signature("B", b)
  62. test_property_signature("C", c)
  63. print("=== Class Methods ===")
  64. test_method_signature("A", A as GDScript)
  65. test_method_signature("B", B as GDScript)
  66. test_method_signature("C", C as GDScript)
  67. print("=== Member Methods ===")
  68. test_method_signature("B", b)
  69. test_method_signature("C", c)
  70. print("=== Signals ===")
  71. test_signal_signature("B", b)
  72. test_signal_signature("C", c)