From 5a5a062d6109c42936fd46289ee2395f7d1a3099 Mon Sep 17 00:00:00 2001 From: Yuri Roubinsky Date: Sun, 6 Oct 2019 17:24:30 +0300 Subject: Fix few redefinition name errors for variable/param/function in shaders --- servers/visual/shader_language.cpp | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) (limited to 'servers') diff --git a/servers/visual/shader_language.cpp b/servers/visual/shader_language.cpp index 3b549afb02..30bd5884a2 100644 --- a/servers/visual/shader_language.cpp +++ b/servers/visual/shader_language.cpp @@ -3842,9 +3842,12 @@ Error ShaderLanguage::_parse_block(BlockNode *p_block, const Map &p_funct pname = tk.text; - if (_find_identifier(func_node->body, builtin_types, pname)) { - _set_error("Redefinition of '" + String(pname) + "'"); - return ERR_PARSE_ERROR; + ShaderLanguage::IdentifierType itype; + if (_find_identifier(func_node->body, builtin_types, pname, (ShaderLanguage::DataType *)0, &itype)) { + if (itype != IDENTIFIER_FUNCTION) { + _set_error("Redefinition of '" + String(pname) + "'"); + return ERR_PARSE_ERROR; + } } FunctionNode::Argument arg; arg.type = ptype; -- cgit v1.2.3