Merge pull request #55515 from Chaosus/shader_fix_struct_name
This commit is contained in:
commit
b9d877e55f
|
@ -7502,7 +7502,7 @@ Error ShaderLanguage::_parse_shader(const Map<StringName, FunctionInfo> &p_funct
|
||||||
tk = _get_token();
|
tk = _get_token();
|
||||||
if (tk.type == TK_IDENTIFIER) {
|
if (tk.type == TK_IDENTIFIER) {
|
||||||
st.name = tk.text;
|
st.name = tk.text;
|
||||||
if (shader->structs.has(st.name)) {
|
if (shader->constants.has(st.name) || shader->structs.has(st.name)) {
|
||||||
_set_error("Redefinition of '" + String(st.name) + "'");
|
_set_error("Redefinition of '" + String(st.name) + "'");
|
||||||
return ERR_PARSE_ERROR;
|
return ERR_PARSE_ERROR;
|
||||||
}
|
}
|
||||||
|
@ -8212,12 +8212,7 @@ Error ShaderLanguage::_parse_shader(const Map<StringName, FunctionInfo> &p_funct
|
||||||
return ERR_PARSE_ERROR;
|
return ERR_PARSE_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_find_identifier(nullptr, false, constants, name)) {
|
if (shader->structs.has(name) || _find_identifier(nullptr, false, constants, name) || has_builtin(p_functions, name)) {
|
||||||
_set_error("Redefinition of '" + String(name) + "'");
|
|
||||||
return ERR_PARSE_ERROR;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (has_builtin(p_functions, name)) {
|
|
||||||
_set_error("Redefinition of '" + String(name) + "'");
|
_set_error("Redefinition of '" + String(name) + "'");
|
||||||
return ERR_PARSE_ERROR;
|
return ERR_PARSE_ERROR;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue