diff options
author | SnailRhymer <harrymilnes@hotmail.com> | 2022-05-25 01:22:19 +0100 |
---|---|---|
committer | SnailRhymer <harrymilnes@hotmail.com> | 2022-05-25 16:41:10 +0100 |
commit | 3a87d1acae69737daf8ebabb415f5f3e5c5fa882 (patch) | |
tree | a509d832178d98dbb21e8a2de1d7990d3a98e624 /modules | |
parent | 19e3c7fcd9d3ec533f3e81b4ec77636d32ff9b24 (diff) |
Make Lookup Symbol recognize assert and preload in the script editor
Diffstat (limited to 'modules')
-rw-r--r-- | modules/gdscript/gdscript_editor.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/modules/gdscript/gdscript_editor.cpp b/modules/gdscript/gdscript_editor.cpp index 5b63fe7466..0f6d31ba45 100644 --- a/modules/gdscript/gdscript_editor.cpp +++ b/modules/gdscript/gdscript_editor.cpp @@ -3155,7 +3155,7 @@ static Error _lookup_symbol_from_base(const GDScriptParser::DataType &p_base, co } ::Error GDScriptLanguage::lookup_code(const String &p_code, const String &p_symbol, const String &p_path, Object *p_owner, LookupResult &r_result) { - // Before parsing, try the usual stuff + // Before parsing, try the usual stuff. if (ClassDB::class_exists(p_symbol)) { r_result.type = ScriptLanguage::LOOKUP_RESULT_CLASS; r_result.class_name = p_symbol; @@ -3171,7 +3171,9 @@ static Error _lookup_symbol_from_base(const GDScriptParser::DataType &p_base, co } } - if (GDScriptUtilityFunctions::function_exists(p_symbol)) { + // Need special checks for assert and preload as they are technically + // keywords, so are not registered in GDScriptUtilityFunctions. + if (GDScriptUtilityFunctions::function_exists(p_symbol) || "assert" == p_symbol || "preload" == p_symbol) { r_result.type = ScriptLanguage::LOOKUP_RESULT_CLASS_METHOD; r_result.class_name = "@GDScript"; r_result.class_member = p_symbol; |