| ... | @@ -4314,12 +4314,16 @@ static IrInstruction *ir_gen_while_expr(IrBuilder *irb, Scope *scope, AstNode *n | ... | @@ -4314,12 +4314,16 @@ static IrInstruction *ir_gen_while_expr(IrBuilder *irb, Scope *scope, AstNode *n |
| 4314 | if (continue_expr_node) { | 4314 | if (continue_expr_node) { |
| 4315 | ir_set_cursor_at_end(irb, continue_block); | 4315 | ir_set_cursor_at_end(irb, continue_block); |
| 4316 | IrInstruction *expr_result = ir_gen_node(irb, continue_expr_node, scope); | 4316 | IrInstruction *expr_result = ir_gen_node(irb, continue_expr_node, scope); |
| | 4317 | if (expr_result == irb->codegen->invalid_instruction) |
| | 4318 | return expr_result; |
| 4317 | if (!instr_is_unreachable(expr_result)) | 4319 | if (!instr_is_unreachable(expr_result)) |
| 4318 | ir_mark_gen(ir_build_br(irb, scope, node, cond_block, is_comptime)); | 4320 | ir_mark_gen(ir_build_br(irb, scope, node, cond_block, is_comptime)); |
| 4319 | } | 4321 | } |
| 4320 | | 4322 | |
| 4321 | ir_set_cursor_at_end(irb, cond_block); | 4323 | ir_set_cursor_at_end(irb, cond_block); |
| 4322 | IrInstruction *cond_val = ir_gen_node(irb, node->data.while_expr.condition, scope); | 4324 | IrInstruction *cond_val = ir_gen_node(irb, node->data.while_expr.condition, scope); |
| | 4325 | if (cond_val == irb->codegen->invalid_instruction) |
| | 4326 | return cond_val; |
| 4323 | if (!instr_is_unreachable(cond_val)) { | 4327 | if (!instr_is_unreachable(cond_val)) { |
| 4324 | ir_mark_gen(ir_build_cond_br(irb, scope, node->data.while_expr.condition, cond_val, | 4328 | ir_mark_gen(ir_build_cond_br(irb, scope, node->data.while_expr.condition, cond_val, |
| 4325 | body_block, end_block, is_comptime)); | 4329 | body_block, end_block, is_comptime)); |
| ... | @@ -4332,6 +4336,8 @@ static IrInstruction *ir_gen_while_expr(IrBuilder *irb, Scope *scope, AstNode *n | ... | @@ -4332,6 +4336,8 @@ static IrInstruction *ir_gen_while_expr(IrBuilder *irb, Scope *scope, AstNode *n |
| 4332 | loop_stack_item->continue_block = continue_block; | 4336 | loop_stack_item->continue_block = continue_block; |
| 4333 | loop_stack_item->is_comptime = is_comptime; | 4337 | loop_stack_item->is_comptime = is_comptime; |
| 4334 | IrInstruction *body_result = ir_gen_node(irb, node->data.while_expr.body, scope); | 4338 | IrInstruction *body_result = ir_gen_node(irb, node->data.while_expr.body, scope); |
| | 4339 | if (body_result == irb->codegen->invalid_instruction) |
| | 4340 | return body_result; |
| 4335 | irb->loop_stack.pop(); | 4341 | irb->loop_stack.pop(); |
| 4336 | | 4342 | |
| 4337 | if (!instr_is_unreachable(body_result)) | 4343 | if (!instr_is_unreachable(body_result)) |
| ... | @@ -7215,22 +7221,21 @@ static TypeTableEntry *ir_analyze_array_cat(IrAnalyze *ira, IrInstructionBinOp * | ... | @@ -7215,22 +7221,21 @@ static TypeTableEntry *ir_analyze_array_cat(IrAnalyze *ira, IrInstructionBinOp * |
| 7215 | TypeTableEntry *result_type; | 7221 | TypeTableEntry *result_type; |
| 7216 | ConstExprValue *out_array_val; | 7222 | ConstExprValue *out_array_val; |
| 7217 | size_t new_len = (op1_array_end - op1_array_index) + (op2_array_end - op2_array_index); | 7223 | size_t new_len = (op1_array_end - op1_array_index) + (op2_array_end - op2_array_index); |
| 7218 | TypeTableEntry *out_array_type = get_array_type(ira->codegen, child_type, new_len); | | |
| 7219 | if (op1_canon_type->id == TypeTableEntryIdArray || op2_canon_type->id == TypeTableEntryIdArray) { | 7224 | if (op1_canon_type->id == TypeTableEntryIdArray || op2_canon_type->id == TypeTableEntryIdArray) { |
| 7220 | result_type = out_array_type; | 7225 | result_type = get_array_type(ira->codegen, child_type, new_len); |
| 7221 | | 7226 | |
| 7222 | out_array_val = out_val; | 7227 | out_array_val = out_val; |
| 7223 | } else { | 7228 | } else { |
| | 7229 | new_len += 1; // null byte |
| | 7230 | |
| 7224 | result_type = get_pointer_to_type(ira->codegen, child_type, true); | 7231 | result_type = get_pointer_to_type(ira->codegen, child_type, true); |
| 7225 | | 7232 | |
| 7226 | out_array_val = allocate<ConstExprValue>(1); | 7233 | out_array_val = allocate<ConstExprValue>(1); |
| 7227 | out_array_val->special = ConstValSpecialStatic; | 7234 | out_array_val->special = ConstValSpecialStatic; |
| 7228 | out_array_val->type = out_array_type; | 7235 | out_array_val->type = get_array_type(ira->codegen, child_type, new_len); |
| 7229 | out_val->data.x_ptr.base_ptr = out_array_val; | 7236 | out_val->data.x_ptr.base_ptr = out_array_val; |
| 7230 | out_val->data.x_ptr.index = 0; | 7237 | out_val->data.x_ptr.index = 0; |
| 7231 | out_val->data.x_ptr.special = ConstPtrSpecialCStr; | 7238 | out_val->data.x_ptr.special = ConstPtrSpecialCStr; |
| 7232 | | | |
| 7233 | new_len += 1; // null byte | | |
| 7234 | } | 7239 | } |
| 7235 | out_array_val->data.x_array.elements = allocate<ConstExprValue>(new_len); | 7240 | out_array_val->data.x_array.elements = allocate<ConstExprValue>(new_len); |
| 7236 | out_array_val->data.x_array.size = new_len; | 7241 | out_array_val->data.x_array.size = new_len; |