Allow for constant deceleration to be detected inherited scripts above the immediate parent.

This commit is contained in:
Saracen 2019-09-11 06:19:20 +01:00
parent 24e1039eb6
commit cf00f35a8e

View File

@ -5727,10 +5727,11 @@ GDScriptParser::DataType GDScriptParser::_resolve_type(const DataType &p_source,
}
}
// Still look for class constants in parent script
// Still look for class constants in parent scripts
if (!found && (base_type.kind == DataType::GDSCRIPT || base_type.kind == DataType::SCRIPT)) {
Ref<Script> scr = base_type.script_type;
ERR_FAIL_COND_V(scr.is_null(), result);
while (scr.is_valid()) {
Map<StringName, Variant> constants;
scr->get_constants(&constants);
@ -5750,6 +5751,12 @@ GDScriptParser::DataType GDScriptParser::_resolve_type(const DataType &p_source,
}
}
}
if (found) {
break;
} else {
scr = scr->get_base_script();
}
}
}
if (!found && !for_completion) {