1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-05 12:10:55 +00:00

Fix enums coming from other classes without preload

Fix #19704, fix #26001
This commit is contained in:
Bojidar Marinov
2019-03-05 23:19:02 +02:00
parent c40877bc6a
commit 9637e42705
3 changed files with 35 additions and 0 deletions

View File

@@ -815,6 +815,16 @@ GDScriptParser::Node *GDScriptParser::_parse_expression(Node *p_parent, bool p_s
}
if (!dependencies_only) {
if (!bfn && ScriptServer::is_global_class(identifier)) {
Ref<Script> scr = ResourceLoader::load(ScriptServer::get_global_class_path(identifier));
if (scr.is_valid() && scr->is_valid()) {
ConstantNode *constant = alloc_node<ConstantNode>();
constant->value = scr;
expr = constant;
bfn = true;
}
}
// Check parents for the constant
if (!bfn && cln->extends_file != StringName()) {
Ref<GDScript> parent = ResourceLoader::load(cln->extends_file);
@@ -7247,6 +7257,7 @@ GDScriptParser::DataType GDScriptParser::_reduce_identifier_type(const DataType
DataType result;
result.has_type = true;
result.script_type = scr;
result.is_constant = true;
result.is_meta_type = true;
Ref<GDScript> gds = scr;
if (gds.is_valid()) {
@@ -7297,6 +7308,7 @@ GDScriptParser::DataType GDScriptParser::_reduce_identifier_type(const DataType
if (singleton.is_valid()) {
DataType result;
result.has_type = true;
result.is_constant = true;
result.script_type = singleton;
Ref<GDScript> gds = singleton;