diff options
author | Juan Linietsky <reduzio@gmail.com> | 2017-08-20 16:15:08 -0300 |
---|---|---|
committer | Juan Linietsky <reduzio@gmail.com> | 2017-08-20 16:15:46 -0300 |
commit | 834112772b9cb1f7c1ca04b43ab26e23acb149bc (patch) | |
tree | d8ad975270c4e502e167555ae617aa0902f7400f | |
parent | 952db3e676bc5711b3e99e4f11f4510d66831335 (diff) |
property validate assignment condition in new variables, fixes #9411
-rw-r--r-- | servers/visual/shader_language.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/servers/visual/shader_language.cpp b/servers/visual/shader_language.cpp index f8350ce0f8..3e0a1a6f45 100644 --- a/servers/visual/shader_language.cpp +++ b/servers/visual/shader_language.cpp @@ -1931,7 +1931,8 @@ bool ShaderLanguage::_validate_function_call(BlockNode *p_block, OperatorNode *p } if (!fail) { - p_func->return_cache = pfunc->return_type; + if (r_ret_type) + *r_ret_type = pfunc->return_type; return true; } } @@ -3150,6 +3151,11 @@ Error ShaderLanguage::_parse_block(BlockNode *p_block, const Map<StringName, Dat assign->op = OP_ASSIGN; p_block->statements.push_back(assign); tk = _get_token(); + + if (!_validate_operator(assign)) { + _set_error("Invalid assignment of '" + get_datatype_name(n->get_datatype()) + "' to '" + get_datatype_name(type) + "'"); + return ERR_PARSE_ERROR; + } } if (tk.type == TK_COMMA) { |