You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-18 14:21:41 +00:00
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:
@@ -1427,6 +1427,8 @@ private:
|
||||
void reset_extents(Node *p_node, GDScriptTokenizer::Token p_token);
|
||||
void reset_extents(Node *p_node, Node *p_from);
|
||||
|
||||
HashSet<String> dependencies;
|
||||
|
||||
template <typename T>
|
||||
T *alloc_node() {
|
||||
T *node = memnew(T);
|
||||
@@ -1568,9 +1570,11 @@ public:
|
||||
bool annotation_exists(const String &p_annotation_name) const;
|
||||
|
||||
const List<ParserError> &get_errors() const { return errors; }
|
||||
const List<String> get_dependencies() const {
|
||||
// TODO: Keep track of deps.
|
||||
return List<String>();
|
||||
const HashSet<String> &get_dependencies() const {
|
||||
return dependencies;
|
||||
}
|
||||
void add_dependency(const String &p_dependency) {
|
||||
dependencies.insert(p_dependency);
|
||||
}
|
||||
#ifdef DEBUG_ENABLED
|
||||
const List<GDScriptWarning> &get_warnings() const { return warnings; }
|
||||
|
||||
Reference in New Issue
Block a user