Added missing form of array constructor in shaders
This commit is contained in:
parent
94a9cdb3b0
commit
1eb8d5e142
1 changed files with 28 additions and 19 deletions
|
@ -3964,33 +3964,42 @@ Error ShaderLanguage::_parse_block(BlockNode *p_block, const Map<StringName, Bui
|
||||||
|
|
||||||
tk = _get_token();
|
tk = _get_token();
|
||||||
if (tk.type == TK_BRACKET_OPEN) {
|
if (tk.type == TK_BRACKET_OPEN) {
|
||||||
Node *n = _parse_and_reduce_expression(p_block, p_builtin_types);
|
TkPos pos2 = _get_tkpos();
|
||||||
if (!n || n->type != Node::TYPE_CONSTANT || n->get_datatype() != TYPE_INT) {
|
tk = _get_token();
|
||||||
_set_error("Expected single integer constant > 0");
|
if (tk.type == TK_BRACKET_CLOSE) {
|
||||||
return ERR_PARSE_ERROR;
|
array_size2 = var.array_size;
|
||||||
}
|
tk = _get_token();
|
||||||
|
} else {
|
||||||
|
_set_tkpos(pos2);
|
||||||
|
|
||||||
ConstantNode *cnode = (ConstantNode *)n;
|
Node *n = _parse_and_reduce_expression(p_block, p_builtin_types);
|
||||||
if (cnode->values.size() == 1) {
|
if (!n || n->type != Node::TYPE_CONSTANT || n->get_datatype() != TYPE_INT) {
|
||||||
array_size2 = cnode->values[0].sint;
|
_set_error("Expected single integer constant > 0");
|
||||||
if (array_size2 <= 0) {
|
return ERR_PARSE_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
ConstantNode *cnode = (ConstantNode *)n;
|
||||||
|
if (cnode->values.size() == 1) {
|
||||||
|
array_size2 = cnode->values[0].sint;
|
||||||
|
if (array_size2 <= 0) {
|
||||||
|
_set_error("Expected single integer constant > 0");
|
||||||
|
return ERR_PARSE_ERROR;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
_set_error("Expected single integer constant > 0");
|
_set_error("Expected single integer constant > 0");
|
||||||
return ERR_PARSE_ERROR;
|
return ERR_PARSE_ERROR;
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
_set_error("Expected single integer constant > 0");
|
|
||||||
return ERR_PARSE_ERROR;
|
|
||||||
}
|
|
||||||
|
|
||||||
tk = _get_token();
|
|
||||||
if (tk.type != TK_BRACKET_CLOSE) {
|
|
||||||
_set_error("Expected ']");
|
|
||||||
return ERR_PARSE_ERROR;
|
|
||||||
} else {
|
|
||||||
tk = _get_token();
|
tk = _get_token();
|
||||||
|
if (tk.type != TK_BRACKET_CLOSE) {
|
||||||
|
_set_error("Expected ']'");
|
||||||
|
return ERR_PARSE_ERROR;
|
||||||
|
} else {
|
||||||
|
tk = _get_token();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
_set_error("Expected '[");
|
_set_error("Expected '['");
|
||||||
return ERR_PARSE_ERROR;
|
return ERR_PARSE_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue