godotengine / godotengine/godot
`get_script_method_list()` lists functions from inherited scripts
- Dominant language
- C++
- Stars
- 117k
- Forks
- 26.8k
- PR merge metrics
- PR metrics pending
Description
### Tested versions
- v4.2.2.stable.official [15073afe3]
- v4.3.stable.mono.official [77dcf97d8]
- v4.4.dev2.official [97ef3c837]
### System information
Windows 11
### Issue description
From the official [documentation](https://docs.godotengine.org/en/stable/classes/class_script.html#class-script-method-get-script-method-list) the function `get_script_method_list` should `Returns the list of methods in **this** Script.`
However, the methods of the inherited scripts are also listed, contrary to the documentation.
```gd
class_name CustomClassExtendsCustomClass
extends CustomResourceTestClass
# override
@warning_ignore("untyped_declaration")
func foo2():
return "foo2 overriden"
func bar2() -> String:
return bar()
```
```gd
Script res://CustomClassExtendsCustomClass.gd
{ "name": "foo2", "args": [], "default_args": [], "flags": 1, "id": 0, "return": { "name": "", "class_name": &"", "type": 0, "hint": 0, "hint_string": "", "usage": 131072 } }
{ "name": "bar2", "args": [], "default_args": [], "flags": 1, "id": 0, "return": { "name": "", "class_name": &"", "type": 4, "hint": 0, "hint_string": "", "usage": 0 } }
{ "name": "foo", "args": [], "default_args": [], "flags": 1, "id": 0, "return": { "name": "", "class_name": &"", "type": 4, "hint": 0, "hint_string": "", "usage": 0 } }
{ "name": "foo2", "args": [], "default_args": [], "flags": 1, "id": 0, "return": { "name": "", "class_name": &"", "type": 0, "hint": 0, "hint_string": "", "usage": 131072 } }
{ "name": "foo_void", "args": [], "default_args": [], "flags": 1, "id": 0, "return": { "name": "", "class_name": &"", "type": 0, "hint": 0, "hint_string": "", "usage": 6 } }
{ "name": "bar", "args": [], "default_args": [], "flags": 1, "id": 0, "return": { "name": "", "class_name": &"", "type": 4, "hint": 0, "hint_string": "", "usage": 0 } }
{ "name": "foo5", "args": [], "default_args": [], "flags": 1, "id": 0, "return": { "name": "", "class_name": &"", "type": 0, "hint": 0, "hint_string": "", "usage": 6 } }
Script res://CustomResourceTestClass.gd
{ "name": "foo", "args": [], "default_args": [], "flags": 1, "id": 0, "return": { "name": "", "class_name": &"", "type": 4, "hint": 0, "hint_string": "", "usage": 0 } }
{ "name": "foo2", "args": [], "default_args": [], "flags": 1, "id": 0, "return": { "name": "", "class_name": &"", "type": 0, "hint": 0, "hint_string": "", "usage": 131072 } }
{ "name": "foo_void", "args": [], "default_args": [], "flags": 1, "id": 0, "return": { "name": "", "class_name": &"", "type": 0, "hint": 0, "hint_string": "", "usage": 6 } }
{ "name": "bar", "args": [], "default_args": [], "flags": 1, "id": 0, "return": { "name": "", "class_name": &"", "type": 4, "hint": 0, "hint_string": "", "usage": 0 } }
{ "name": "foo5", "args": [], "default_args": [], "flags": 1, "id": 0, "return": { "name": "", "class_name": &"", "type": 0, "hint": 0, "hint_string": "", "usage": 6 } }
```
### Steps to reproduce
Load the attached project and run the test scene.
### Minimal reproduction project (MRP)
[script_methods.zip](https://github.com/user-attachments/files/17026664/script_methods.zip)
Contributor guide
Research direction
Start at the get_script_method_list() entry point and reproduce the behavior with the attached script_methods.zip project and its test scene. Verify that the returned list for a script contains only methods defined in that script, rather than methods inherited from its base script, and add or update coverage for the reported inheritance case.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp, godot
- Domain
- game-dev
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100