diff options
author | RĂ©mi Verschelde <rverschelde@gmail.com> | 2018-01-04 15:17:10 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-01-04 15:17:10 +0100 |
commit | 0b07d453f719f92cce6c92fa229b8a0d0284b634 (patch) | |
tree | 2d4b9e59007a013da12fb8017ff684888afa853e /servers/visual | |
parent | e315c94900be47e61152a2958011e14b7e635a3e (diff) | |
parent | f141bafba386e996b37e2e7486fc5881cb806bf7 (diff) |
Merge pull request #15251 from binbitten/fix-assign-vardecl
Fix premature declaration of shader variables created with assignment
Diffstat (limited to 'servers/visual')
-rw-r--r-- | servers/visual/shader_language.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/servers/visual/shader_language.cpp b/servers/visual/shader_language.cpp index 1828cf8a4b..f0f93ff2a7 100644 --- a/servers/visual/shader_language.cpp +++ b/servers/visual/shader_language.cpp @@ -3209,8 +3209,6 @@ Error ShaderLanguage::_parse_block(BlockNode *p_block, const Map<StringName, Bui var.precision = precision; var.line = tk_line; - p_block->variables[name] = var; - VariableDeclarationNode::Declaration decl; decl.name = name; @@ -3219,7 +3217,7 @@ Error ShaderLanguage::_parse_block(BlockNode *p_block, const Map<StringName, Bui tk = _get_token(); if (tk.type == TK_OP_ASSIGN) { - //variable creted with assignment! must parse an expression + //variable created with assignment! must parse an expression Node *n = _parse_and_reduce_expression(p_block, p_builtin_types); if (!n) return ERR_PARSE_ERROR; @@ -3233,6 +3231,8 @@ Error ShaderLanguage::_parse_block(BlockNode *p_block, const Map<StringName, Bui tk = _get_token(); } + p_block->variables[name] = var; + vardecl->declarations.push_back(decl); if (tk.type == TK_COMMA) { |