Merge pull request from Chaosus/shader_fix_return

This commit is contained in:
Rémi Verschelde 2021-11-23 10:59:16 +01:00 committed by GitHub
commit bf341bf430
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -7190,11 +7190,6 @@ Error ShaderLanguage::_parse_block(BlockNode *p_block, const FunctionInfo &p_fun
//check return type
BlockNode *b = p_block;
if (b && b->parent_function && p_function_info.main_function) {
_set_error(vformat("Using 'return' in '%s' processor function results in undefined behavior!", b->parent_function->name));
return ERR_PARSE_ERROR;
}
while (b && !b->parent_function) {
b = b->parent_block;
}
@ -7204,6 +7199,11 @@ Error ShaderLanguage::_parse_block(BlockNode *p_block, const FunctionInfo &p_fun
return ERR_BUG;
}
if (b && b->parent_function && p_function_info.main_function) {
_set_error(vformat("Using 'return' in '%s' processor function results in undefined behavior!", b->parent_function->name));
return ERR_PARSE_ERROR;
}
String return_struct_name = String(b->parent_function->return_struct_name);
String array_size_string;