1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-19 14:31:59 +00:00

Implements length() shader function for arrays in structs

This commit is contained in:
Yuri Roubinsky
2021-05-19 21:50:11 +03:00
parent f1f5b92b8e
commit 6135744786
3 changed files with 13 additions and 2 deletions

View File

@@ -4301,8 +4301,15 @@ ShaderLanguage::Node *ShaderLanguage::_parse_expression(BlockNode *p_block, cons
}
mn->assign_expression = assign_expression;
} else if (tk.type == TK_PERIOD) {
_set_error("Nested array length() is not yet implemented");
return nullptr;
completion_class = TAG_ARRAY;
p_block->block_tag = SubClassTag::TAG_ARRAY;
Node *call_expression = _parse_and_reduce_expression(p_block, p_function_info);
p_block->block_tag = SubClassTag::TAG_GLOBAL;
if (!call_expression) {
return nullptr;
}
mn->datatype = call_expression->get_datatype();
mn->call_expression = call_expression;
} else if (tk.type == TK_BRACKET_OPEN) {
Node *index_expression = _parse_and_reduce_expression(p_block, p_function_info);
if (!index_expression) {