Browse Source

Merge pull request #17255 from x1212/preload_enum_export_fix

fix enum from preloaded script in export
Rémi Verschelde 7 years ago
parent
commit
d3e788a6b8
1 changed files with 7 additions and 4 deletions
  1. 7 4
      modules/gdscript/gdscript_parser.cpp

+ 7 - 4
modules/gdscript/gdscript_parser.cpp

@@ -461,18 +461,21 @@ GDScriptParser::Node *GDScriptParser::_parse_expression(Node *p_parent, bool p_s
 				} else if (!for_completion || FileAccess::exists(path)) {
 					res = ResourceLoader::load(path);
 				}
-				if (!res.is_valid()) {
-					_set_error("Can't preload resource at path: " + path);
-					return NULL;
-				}
 			} else {
 
 				if (!FileAccess::exists(path)) {
 					_set_error("Can't preload resource at path: " + path);
 					return NULL;
+				} else if (ScriptCodeCompletionCache::get_singleton()) {
+					res = ScriptCodeCompletionCache::get_singleton()->get_cached_resource(path);
 				}
 			}
 
+			if (!res.is_valid()) {
+				_set_error("Can't preload resource at path: " + path);
+				return NULL;
+			}
+
 			if (tokenizer->get_token() != GDScriptTokenizer::TK_PARENTHESIS_CLOSE) {
 				_set_error("Expected ')' after 'preload' path");
 				return NULL;