diff options
author | George Marques <george@gmarqu.es> | 2020-08-19 10:45:00 -0300 |
---|---|---|
committer | George Marques <george@gmarqu.es> | 2020-08-19 10:45:00 -0300 |
commit | f9ad0b30fa5b1eac505fc8a2bac73da9653a4d04 (patch) | |
tree | 24dd5f10a65a0319cf17044746d9b6ae5a0ec6f4 /modules/gdscript/gdscript_parser.cpp | |
parent | a52e457adaf4a0618879b290fb043edd5385c2fd (diff) | |
download | redot-engine-f9ad0b30fa5b1eac505fc8a2bac73da9653a4d04.tar.gz |
GDScript: Allow preload() to be used with constant expressions
Diffstat (limited to 'modules/gdscript/gdscript_parser.cpp')
-rw-r--r-- | modules/gdscript/gdscript_parser.cpp | 23 |
1 files changed, 0 insertions, 23 deletions
diff --git a/modules/gdscript/gdscript_parser.cpp b/modules/gdscript/gdscript_parser.cpp index adc3699519..b442bf9199 100644 --- a/modules/gdscript/gdscript_parser.cpp +++ b/modules/gdscript/gdscript_parser.cpp @@ -2524,29 +2524,6 @@ GDScriptParser::ExpressionNode *GDScriptParser::parse_preload(ExpressionNode *p_ if (preload->path == nullptr) { push_error(R"(Expected resource path after "(".)"); - } else if (preload->path->type != Node::LITERAL) { - push_error("Preloaded path must be a constant string."); - } else { - LiteralNode *path = static_cast<LiteralNode *>(preload->path); - if (path->value.get_type() != Variant::STRING) { - push_error("Preloaded path must be a constant string."); - } else { - preload->resolved_path = path->value; - // TODO: Save this as script dependency. - if (preload->resolved_path.is_rel_path()) { - preload->resolved_path = script_path.get_base_dir().plus_file(preload->resolved_path); - } - preload->resolved_path = preload->resolved_path.simplify_path(); - if (!FileAccess::exists(preload->resolved_path)) { - push_error(vformat(R"(Preload file "%s" does not exist.)", preload->resolved_path)); - } else { - // TODO: Don't load if validating: use completion cache. - preload->resource = ResourceLoader::load(preload->resolved_path); - if (preload->resource.is_null()) { - push_error(vformat(R"(Could not preload resource file "%s".)", preload->resolved_path)); - } - } - } } pop_completion_call(); |