1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-09 12:50:35 +00:00

Fixed help lookup not finding classes, issue 11867

This commit is contained in:
Paulb23
2017-11-10 23:20:04 +00:00
parent b3c08a8326
commit b835aec87b

View File

@@ -2771,31 +2771,31 @@ Error GDScriptLanguage::lookup_code(const String &p_code, const String &p_symbol
} }
//global //global
for (Map<StringName, int>::Element *E = GDScriptLanguage::get_singleton()->get_global_map().front(); E; E = E->next()) { Map<StringName, int> classes = GDScriptLanguage::get_singleton()->get_global_map();
if (E->key() == p_symbol) { if (classes.has(p_symbol)) {
Variant value = GDScriptLanguage::get_singleton()->get_global_array()[classes[p_symbol]];
Variant value = GDScriptLanguage::get_singleton()->get_global_array()[E->get()]; if (value.get_type() == Variant::OBJECT) {
if (value.get_type() == Variant::OBJECT) { Object *obj = value;
Object *obj = value; if (obj) {
if (obj) { if (Object::cast_to<GDNativeClass>(obj)) {
r_result.type = ScriptLanguage::LookupResult::RESULT_CLASS;
if (Object::cast_to<GDNativeClass>(obj)) { r_result.class_name = Object::cast_to<GDNativeClass>(obj)->get_name();
r_result.type = ScriptLanguage::LookupResult::RESULT_CLASS; } else {
r_result.class_name = Object::cast_to<GDNativeClass>(obj)->get_name(); r_result.type = ScriptLanguage::LookupResult::RESULT_CLASS;
r_result.class_name = obj->get_class();
} else {
r_result.type = ScriptLanguage::LookupResult::RESULT_CLASS;
r_result.class_name = obj->get_class();
}
return OK;
} }
} else {
r_result.type = ScriptLanguage::LookupResult::RESULT_CLASS_CONSTANT; // proxy class remove the underscore.
r_result.class_name = "@Global Scope"; if (r_result.class_name.begins_with("_")) {
r_result.class_member = p_symbol; r_result.class_name = r_result.class_name.right(1);
}
return OK; return OK;
} }
} else {
r_result.type = ScriptLanguage::LookupResult::RESULT_CLASS_CONSTANT;
r_result.class_name = "@Global Scope";
r_result.class_member = p_symbol;
return OK;
} }
} }
} }