1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-09 12:50:35 +00:00

Added missing returns on error scenarios

(cherry picked from commit 3d9ef1e4de)
This commit is contained in:
Ev1lbl0w
2021-02-28 19:02:52 +00:00
committed by Rémi Verschelde
parent 28365a5258
commit 3fe851accc

View File

@@ -4698,16 +4698,16 @@ Error ShaderLanguage::_parse_block(BlockNode *p_block, const Map<StringName, Bui
pos = _get_tkpos(); pos = _get_tkpos();
tk = _get_token(); tk = _get_token();
if (tk.type != TK_SEMICOLON) { if (tk.type != TK_SEMICOLON) {
//all is good
_set_error("Expected ';' after discard"); _set_error("Expected ';' after discard");
return ERR_PARSE_ERROR;
} }
p_block->statements.push_back(flow); p_block->statements.push_back(flow);
} else if (tk.type == TK_CF_BREAK) { } else if (tk.type == TK_CF_BREAK) {
if (!p_can_break) { if (!p_can_break) {
//all is good _set_error("'break' is not allowed outside of a loop or 'switch' statement");
_set_error("Breaking is not allowed here"); return ERR_PARSE_ERROR;
} }
ControlFlowNode *flow = alloc_node<ControlFlowNode>(); ControlFlowNode *flow = alloc_node<ControlFlowNode>();
@@ -4716,8 +4716,8 @@ Error ShaderLanguage::_parse_block(BlockNode *p_block, const Map<StringName, Bui
pos = _get_tkpos(); pos = _get_tkpos();
tk = _get_token(); tk = _get_token();
if (tk.type != TK_SEMICOLON) { if (tk.type != TK_SEMICOLON) {
//all is good
_set_error("Expected ';' after break"); _set_error("Expected ';' after break");
return ERR_PARSE_ERROR;
} }
p_block->statements.push_back(flow); p_block->statements.push_back(flow);
@@ -4733,8 +4733,8 @@ Error ShaderLanguage::_parse_block(BlockNode *p_block, const Map<StringName, Bui
} else if (tk.type == TK_CF_CONTINUE) { } else if (tk.type == TK_CF_CONTINUE) {
if (!p_can_continue) { if (!p_can_continue) {
//all is good _set_error("'continue' is not allowed outside of a loop");
_set_error("Continuing is not allowed here"); return ERR_PARSE_ERROR;
} }
ControlFlowNode *flow = alloc_node<ControlFlowNode>(); ControlFlowNode *flow = alloc_node<ControlFlowNode>();
@@ -4745,6 +4745,7 @@ Error ShaderLanguage::_parse_block(BlockNode *p_block, const Map<StringName, Bui
if (tk.type != TK_SEMICOLON) { if (tk.type != TK_SEMICOLON) {
//all is good //all is good
_set_error("Expected ';' after continue"); _set_error("Expected ';' after continue");
return ERR_PARSE_ERROR;
} }
p_block->statements.push_back(flow); p_block->statements.push_back(flow);