diff options
-rw-r--r-- | servers/rendering/shader_language.cpp | 5 | ||||
-rw-r--r-- | servers/rendering/shader_language.h | 1 |
2 files changed, 6 insertions, 0 deletions
diff --git a/servers/rendering/shader_language.cpp b/servers/rendering/shader_language.cpp index cf2a01c07c..300c38db22 100644 --- a/servers/rendering/shader_language.cpp +++ b/servers/rendering/shader_language.cpp @@ -5070,6 +5070,10 @@ Error ShaderLanguage::_parse_block(BlockNode *p_block, const Map<StringName, Bui p_block->variables[name] = var; if (tk.type == TK_COMMA) { + if (p_block->block_type == BlockNode::BLOCK_TYPE_FOR) { + _set_error("Multiple declarations in 'for' loop are not implemented yet."); + return ERR_PARSE_ERROR; + } tk = _get_token(); //another variable } else if (tk.type == TK_SEMICOLON) { @@ -5394,6 +5398,7 @@ Error ShaderLanguage::_parse_block(BlockNode *p_block, const Map<StringName, Bui cf->flow_op = FLOW_OP_FOR; BlockNode *init_block = alloc_node<BlockNode>(); + init_block->block_type = BlockNode::BLOCK_TYPE_FOR; init_block->parent_block = p_block; init_block->single_statement = true; cf->blocks.push_back(init_block); diff --git a/servers/rendering/shader_language.h b/servers/rendering/shader_language.h index bdc15cc4aa..9124bee633 100644 --- a/servers/rendering/shader_language.h +++ b/servers/rendering/shader_language.h @@ -487,6 +487,7 @@ public: enum BlockType { BLOCK_TYPE_STANDART, + BLOCK_TYPE_FOR, BLOCK_TYPE_SWITCH, BLOCK_TYPE_CASE, BLOCK_TYPE_DEFAULT, |