summaryrefslogtreecommitdiff
path: root/servers
diff options
context:
space:
mode:
authorYuri Roubinsky <chaosus89@gmail.com>2019-10-06 17:46:24 +0300
committerGitHub <noreply@github.com>2019-10-06 17:46:24 +0300
commit09a3d8f5c4a7f1e696b8b8075ef2ca8877714314 (patch)
treed0ee0f41e966d6a2809de3a4049b6655577c13df /servers
parent1d9233c3882afe888b9396f7f2aac917d4dcac4d (diff)
parent5a5a062d6109c42936fd46289ee2395f7d1a3099 (diff)
Merge pull request #32590 from Chaosus/fix_shader_regression
Fix few redefinition name errors for variable/param/function in shaders
Diffstat (limited to 'servers')
-rw-r--r--servers/visual/shader_language.cpp18
1 files changed, 12 insertions, 6 deletions
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<StringName, Bui
}
StringName name = tk.text;
- if (_find_identifier(p_block, p_builtin_types, name)) {
- _set_error("Redefinition of '" + String(name) + "'");
- return ERR_PARSE_ERROR;
+ ShaderLanguage::IdentifierType itype;
+ if (_find_identifier(p_block, p_builtin_types, name, (ShaderLanguage::DataType *)0, &itype)) {
+ if (itype != IDENTIFIER_FUNCTION) {
+ _set_error("Redefinition of '" + String(name) + "'");
+ return ERR_PARSE_ERROR;
+ }
}
BlockNode::Variable var;
@@ -5121,9 +5124,12 @@ Error ShaderLanguage::_parse_shader(const Map<StringName, FunctionInfo> &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;