GDScript: Implement get_dependencies()

The parser and analyzer now track the dependencies of the script and
return the list when the resource loader ask for them.

What is considered a dependency:

- Any `preload()` call.
- The base script this one extends.
- Any identifier, including types, that refers to global scripts.
- Any autoload singleton reference.
This commit is contained in:
George Marques
2024-04-18 11:48:07 -03:00
parent 2efbc6bfb3
commit dc73440f89
4 changed files with 29 additions and 7 deletions

View File

@ -633,7 +633,7 @@ public:
virtual void get_recognized_extensions(List<String> *p_extensions) const override;
virtual bool handles_type(const String &p_type) const override;
virtual String get_resource_type(const String &p_path) const override;
virtual void get_dependencies(const String &p_path, List<String> *p_dependencies, bool p_add_types = false) override;
virtual void get_dependencies(const String &p_path, List<String> *r_dependencies, bool p_add_types = false) override;
};
class ResourceFormatSaverGDScript : public ResourceFormatSaver {