Prevent return statement from using in block in shader main functions
This commit is contained in:
parent
dbef4bbd98
commit
c7043dbfdc
1 changed files with 5 additions and 5 deletions
|
@ -7190,11 +7190,6 @@ Error ShaderLanguage::_parse_block(BlockNode *p_block, const FunctionInfo &p_fun
|
||||||
//check return type
|
//check return type
|
||||||
BlockNode *b = p_block;
|
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) {
|
while (b && !b->parent_function) {
|
||||||
b = b->parent_block;
|
b = b->parent_block;
|
||||||
}
|
}
|
||||||
|
@ -7204,6 +7199,11 @@ Error ShaderLanguage::_parse_block(BlockNode *p_block, const FunctionInfo &p_fun
|
||||||
return ERR_BUG;
|
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 return_struct_name = String(b->parent_function->return_struct_name);
|
||||||
String array_size_string;
|
String array_size_string;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue