| ... | ... | @@ -359,6 +359,28 @@ static bool eval_container_init_expr(EvalFn *ef, AstNode *node, ConstExprValue * |
| 359 | 359 | add_error_note(ef->root->codegen, msg, ef->root->call_node, buf_sprintf("called from here")); |
| 360 | 360 | add_error_note(ef->root->codegen, msg, node, buf_sprintf("unreachable expression here")); |
| 361 | 361 | return true; |
| 362 | } else if (container_type->id == TypeTableEntryIdStruct && |
| 363 | container_type->data.structure.is_unknown_size_array && |
| 364 | kind == ContainerInitKindArray) |
| 365 | { |
| 366 | |
| 367 | int elem_count = container_init_expr->entries.length; |
| 368 | |
| 369 | out_val->ok = true; |
| 370 | out_val->data.x_array.fields = allocate<ConstExprValue*>(elem_count); |
| 371 | |
| 372 | for (int i = 0; i < elem_count; i += 1) { |
| 373 | AstNode *elem_node = container_init_expr->entries.at(i); |
| 374 | |
| 375 | ConstExprValue *elem_val = allocate<ConstExprValue>(1); |
| 376 | if (eval_expr(ef, elem_node, elem_val)) return true; |
| 377 | |
| 378 | assert(elem_val->ok); |
| 379 | |
| 380 | out_val->data.x_array.fields[i] = elem_val; |
| 381 | out_val->depends_on_compile_var = out_val->depends_on_compile_var || |
| 382 | elem_val->depends_on_compile_var; |
| 383 | } |
| 362 | 384 | } else { |
| 363 | 385 | zig_panic("TODO"); |
| 364 | 386 | } |