Fix parse error when extends from subclass of named classes
(cherry picked from commit ebcfe28475
)
This commit is contained in:
parent
4444bd1fcb
commit
6c71289432
|
@ -5238,6 +5238,7 @@ void GDScriptParser::_determine_inheritance(ClassNode *p_class) {
|
||||||
if (base_script.is_valid()) {
|
if (base_script.is_valid()) {
|
||||||
|
|
||||||
String ident = base;
|
String ident = base;
|
||||||
|
Ref<GDScript> find_subclass = base_script;
|
||||||
|
|
||||||
for (int i = extend_iter; i < p_class->extends_class.size(); i++) {
|
for (int i = extend_iter; i < p_class->extends_class.size(); i++) {
|
||||||
|
|
||||||
|
@ -5247,7 +5248,7 @@ void GDScriptParser::_determine_inheritance(ClassNode *p_class) {
|
||||||
|
|
||||||
if (base_script->get_subclasses().has(subclass)) {
|
if (base_script->get_subclasses().has(subclass)) {
|
||||||
|
|
||||||
base_script = base_script->get_subclasses()[subclass];
|
find_subclass = base_script->get_subclasses()[subclass];
|
||||||
} else if (base_script->get_constants().has(subclass)) {
|
} else if (base_script->get_constants().has(subclass)) {
|
||||||
|
|
||||||
Ref<GDScript> new_base_class = base_script->get_constants()[subclass];
|
Ref<GDScript> new_base_class = base_script->get_constants()[subclass];
|
||||||
|
@ -5255,7 +5256,7 @@ void GDScriptParser::_determine_inheritance(ClassNode *p_class) {
|
||||||
_set_error("Constant is not a class: " + ident, p_class->line);
|
_set_error("Constant is not a class: " + ident, p_class->line);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
base_script = new_base_class;
|
find_subclass = new_base_class;
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
_set_error("Could not find subclass: " + ident, p_class->line);
|
_set_error("Could not find subclass: " + ident, p_class->line);
|
||||||
|
@ -5263,7 +5264,7 @@ void GDScriptParser::_determine_inheritance(ClassNode *p_class) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
script = base_script;
|
script = find_subclass;
|
||||||
|
|
||||||
} else if (!base_class) {
|
} else if (!base_class) {
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue