diff options
author | Juan Linietsky <reduzio@gmail.com> | 2016-01-25 10:30:47 -0300 |
---|---|---|
committer | Juan Linietsky <reduzio@gmail.com> | 2016-01-25 10:30:47 -0300 |
commit | 5245adcf81dd61ddb4eac048f6b004f3f455d7ed (patch) | |
tree | 272c46c2ee422d9fe6d4dfaeca51fa52c264ffb3 /modules | |
parent | 07e79094802a2eb2d7c0cd64cecf673db386ec5a (diff) | |
parent | 87517c564b83218871ac53afdad375a9501e6cb8 (diff) |
Merge branch 'master' of https://github.com/godotengine/godot
Diffstat (limited to 'modules')
-rw-r--r-- | modules/gdscript/gd_parser.cpp | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/modules/gdscript/gd_parser.cpp b/modules/gdscript/gd_parser.cpp index 4c6b6ff2dd..b6e8478846 100644 --- a/modules/gdscript/gd_parser.cpp +++ b/modules/gdscript/gd_parser.cpp @@ -283,13 +283,23 @@ GDParser::Node* GDParser::_parse_expression(Node *p_parent,bool p_static,bool p_ return NULL; } tokenizer->advance(); - if (tokenizer->get_token()!=GDTokenizer::TK_CONSTANT || tokenizer->get_token_constant().get_type()!=Variant::STRING) { - _set_error("Expected string constant as 'preload' argument."); + + String path; + bool valid = false; + Node *subexpr = _parse_and_reduce_expression(p_parent, p_static); + if (subexpr) { + if (subexpr->type == Node::TYPE_CONSTANT) { + ConstantNode *cn = static_cast<ConstantNode*>(subexpr); + if (cn->value.get_type() == Variant::STRING) { + valid = true; + path = (String) cn->value; + } + } + } + if (!valid) { + _set_error("expected string constant as 'preload' argument."); return NULL; } - - - String path = tokenizer->get_token_constant(); if (!path.is_abs_path() && base_path!="") path=base_path+"/"+path; path = path.replace("///","//").simplify_path(); @@ -322,8 +332,6 @@ GDParser::Node* GDParser::_parse_expression(Node *p_parent,bool p_static,bool p_ } } - tokenizer->advance(); - if (tokenizer->get_token()!=GDTokenizer::TK_PARENTHESIS_CLOSE) { _set_error("Expected ')' after 'preload' path"); return NULL; |