mirror of
https://github.com/godotengine/godot.git
synced 2025-10-20 00:13:30 +00:00
GDScript: Fix issues when deriving from other scripts
This commit is contained in:
parent
722be9aaef
commit
8ccf88a206
3 changed files with 23 additions and 10 deletions
|
@ -2609,16 +2609,27 @@ Error GDScriptCompiler::_parse_class_level(GDScript *p_script, const GDScriptPar
|
|||
p_script->_base = base.ptr();
|
||||
|
||||
if (p_class->base_type.kind == GDScriptParser::DataType::CLASS && p_class->base_type.class_type != nullptr) {
|
||||
if (!parsed_classes.has(p_script->_base)) {
|
||||
if (parsing_classes.has(p_script->_base)) {
|
||||
String class_name = p_class->identifier ? p_class->identifier->name : "<main>";
|
||||
_set_error("Cyclic class reference for '" + class_name + "'.", p_class);
|
||||
return ERR_PARSE_ERROR;
|
||||
if (p_class->base_type.script_path == main_script->path) {
|
||||
if (!parsed_classes.has(p_script->_base)) {
|
||||
if (parsing_classes.has(p_script->_base)) {
|
||||
String class_name = p_class->identifier ? p_class->identifier->name : "<main>";
|
||||
_set_error("Cyclic class reference for '" + class_name + "'.", p_class);
|
||||
return ERR_PARSE_ERROR;
|
||||
}
|
||||
Error err = _parse_class_level(p_script->_base, p_class->base_type.class_type, p_keep_state);
|
||||
if (err) {
|
||||
return err;
|
||||
}
|
||||
}
|
||||
Error err = _parse_class_level(p_script->_base, p_class->base_type.class_type, p_keep_state);
|
||||
} else {
|
||||
Error err = OK;
|
||||
base = GDScriptCache::get_full_script(p_class->base_type.script_path, err, main_script->path);
|
||||
if (err) {
|
||||
return err;
|
||||
}
|
||||
if (base.is_null() && !base->is_valid()) {
|
||||
return ERR_COMPILATION_FAILED;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue