You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-12-31 18:41:20 +00:00
Fix GDScript extends path recursion to itself
This commit is contained in:
@@ -2826,6 +2826,17 @@ bool GDScriptLanguage::handles_global_class_type(const String &p_type) const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
String GDScriptLanguage::get_global_class_name(const String &p_path, String *r_base_type, String *r_icon_path, bool *r_is_abstract, bool *r_is_tool) const {
|
String GDScriptLanguage::get_global_class_name(const String &p_path, String *r_base_type, String *r_icon_path, bool *r_is_abstract, bool *r_is_tool) const {
|
||||||
|
LocalVector<String> r_vec;
|
||||||
|
return _get_global_class_name(p_path, r_base_type, r_icon_path, r_is_abstract, r_is_tool, r_vec);
|
||||||
|
}
|
||||||
|
|
||||||
|
String GDScriptLanguage::_get_global_class_name(const String &p_path, String *r_base_type, String *r_icon_path, bool *r_is_abstract, bool *r_is_tool, LocalVector<String> &r_visited) const {
|
||||||
|
if (r_visited.has(p_path)) {
|
||||||
|
return String();
|
||||||
|
}
|
||||||
|
|
||||||
|
r_visited.push_back(p_path);
|
||||||
|
|
||||||
Error err;
|
Error err;
|
||||||
Ref<FileAccess> f = FileAccess::open(p_path, FileAccess::READ, &err);
|
Ref<FileAccess> f = FileAccess::open(p_path, FileAccess::READ, &err);
|
||||||
if (err) {
|
if (err) {
|
||||||
@@ -2865,7 +2876,7 @@ String GDScriptLanguage::get_global_class_name(const String &p_path, String *r_b
|
|||||||
if (!subclass->extends_path.is_empty()) {
|
if (!subclass->extends_path.is_empty()) {
|
||||||
if (subclass->extends.is_empty()) {
|
if (subclass->extends.is_empty()) {
|
||||||
// We only care about the referenced class_name.
|
// We only care about the referenced class_name.
|
||||||
_ALLOW_DISCARD_ get_global_class_name(subclass->extends_path, r_base_type);
|
_ALLOW_DISCARD_ _get_global_class_name(subclass->extends_path, r_base_type, nullptr, nullptr, nullptr, r_visited);
|
||||||
subclass = nullptr;
|
subclass = nullptr;
|
||||||
break;
|
break;
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -454,6 +454,8 @@ class GDScriptLanguage : public ScriptLanguage {
|
|||||||
void _add_global(const StringName &p_name, const Variant &p_value);
|
void _add_global(const StringName &p_name, const Variant &p_value);
|
||||||
void _remove_global(const StringName &p_name);
|
void _remove_global(const StringName &p_name);
|
||||||
|
|
||||||
|
String _get_global_class_name(const String &p_path, String *r_base_type, String *r_icon_path, bool *r_is_abstract, bool *r_is_tool, LocalVector<String> &r_visited) const;
|
||||||
|
|
||||||
friend class GDScriptInstance;
|
friend class GDScriptInstance;
|
||||||
|
|
||||||
Mutex mutex;
|
Mutex mutex;
|
||||||
|
|||||||
Reference in New Issue
Block a user