Merge pull request #32590 from Chaosus/fix_shader_regression
Fix few redefinition name errors for variable/param/function in shaders
This commit is contained in:
commit
09a3d8f5c4
1 changed files with 12 additions and 6 deletions
|
@ -3842,10 +3842,13 @@ Error ShaderLanguage::_parse_block(BlockNode *p_block, const Map<StringName, Bui
|
||||||
}
|
}
|
||||||
|
|
||||||
StringName name = tk.text;
|
StringName name = tk.text;
|
||||||
if (_find_identifier(p_block, p_builtin_types, name)) {
|
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) + "'");
|
_set_error("Redefinition of '" + String(name) + "'");
|
||||||
return ERR_PARSE_ERROR;
|
return ERR_PARSE_ERROR;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
BlockNode::Variable var;
|
BlockNode::Variable var;
|
||||||
var.type = type;
|
var.type = type;
|
||||||
|
@ -5121,10 +5124,13 @@ Error ShaderLanguage::_parse_shader(const Map<StringName, FunctionInfo> &p_funct
|
||||||
|
|
||||||
pname = tk.text;
|
pname = tk.text;
|
||||||
|
|
||||||
if (_find_identifier(func_node->body, builtin_types, pname)) {
|
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) + "'");
|
_set_error("Redefinition of '" + String(pname) + "'");
|
||||||
return ERR_PARSE_ERROR;
|
return ERR_PARSE_ERROR;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
FunctionNode::Argument arg;
|
FunctionNode::Argument arg;
|
||||||
arg.type = ptype;
|
arg.type = ptype;
|
||||||
arg.name = pname;
|
arg.name = pname;
|
||||||
|
|
Loading…
Add table
Reference in a new issue