1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-06 12:20:30 +00:00

Fix Array.max() navigating to @GDScript.max() etc.

(cherry picked from commit 2c4aa50648)
This commit is contained in:
Lightning_A
2021-04-22 18:17:01 -06:00
committed by Rémi Verschelde
parent edd63aeefa
commit feaf4e6207

View File

@@ -3342,15 +3342,6 @@ Error GDScriptLanguage::lookup_code(const String &p_code, const String &p_symbol
}
}
for (int i = 0; i < GDScriptFunctions::FUNC_MAX; i++) {
if (GDScriptFunctions::get_func_name(GDScriptFunctions::Function(i)) == p_symbol) {
r_result.type = ScriptLanguage::LookupResult::RESULT_CLASS_METHOD;
r_result.class_name = "@GDScript";
r_result.class_member = p_symbol;
return OK;
}
}
if ("PI" == p_symbol || "TAU" == p_symbol || "INF" == p_symbol || "NAN" == p_symbol) {
r_result.type = ScriptLanguage::LookupResult::RESULT_CLASS_CONSTANT;
r_result.class_name = "@GDScript";
@@ -3566,6 +3557,16 @@ Error GDScriptLanguage::lookup_code(const String &p_code, const String &p_symbol
}
}
for (int i = 0; i < GDScriptFunctions::FUNC_MAX; i++) {
// this has to get run after parsing because otherwise functions like Array.max() will trigger it
if (GDScriptFunctions::get_func_name(GDScriptFunctions::Function(i)) == p_symbol) {
r_result.type = ScriptLanguage::LookupResult::RESULT_CLASS_METHOD;
r_result.class_name = "@GDScript";
r_result.class_member = p_symbol;
return OK;
}
}
return ERR_CANT_RESOLVE;
}