From bda60bfa29a43315755bac92dc15fb0a1a30c22e Mon Sep 17 00:00:00 2001
From: George Marques <george@gmarqu.es>
Date: Sun, 3 Mar 2019 16:36:42 -0300
Subject: Add a dependency search mode for GDScript parser

- This mode avoids loading any other resource.
- Search for class_name now uses this mode, to avoid loading in the scan
thread.
- Implement get_dependencies() for GDScript loader, now exporting
dependencies only should include the preloaded resources.
---
 modules/gdscript/gdscript_parser.h | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

(limited to 'modules/gdscript/gdscript_parser.h')

diff --git a/modules/gdscript/gdscript_parser.h b/modules/gdscript/gdscript_parser.h
index 9c1ea1c7e4..809bff8f20 100644
--- a/modules/gdscript/gdscript_parser.h
+++ b/modules/gdscript/gdscript_parser.h
@@ -533,6 +533,8 @@ private:
 	int error_line;
 	int error_column;
 	bool check_types;
+	bool dependencies_only;
+	List<String> dependencies;
 #ifdef DEBUG_ENABLED
 	Set<int> *safe_lines;
 #endif // DEBUG_ENABLED
@@ -634,7 +636,7 @@ public:
 #ifdef DEBUG_ENABLED
 	const List<GDScriptWarning> &get_warnings() const { return warnings; }
 #endif // DEBUG_ENABLED
-	Error parse(const String &p_code, const String &p_base_path = "", bool p_just_validate = false, const String &p_self_path = "", bool p_for_completion = false, Set<int> *r_safe_lines = NULL);
+	Error parse(const String &p_code, const String &p_base_path = "", bool p_just_validate = false, const String &p_self_path = "", bool p_for_completion = false, Set<int> *r_safe_lines = NULL, bool p_dependencies_only = false);
 	Error parse_bytecode(const Vector<uint8_t> &p_bytecode, const String &p_base_path = "", const String &p_self_path = "");
 
 	bool is_tool_script() const;
@@ -653,6 +655,8 @@ public:
 	int get_completion_argument_index();
 	int get_completion_identifier_is_function();
 
+	const List<String> &get_dependencies() const { return dependencies; }
+
 	void clear();
 	GDScriptParser();
 	~GDScriptParser();
-- 
cgit v1.2.3