Skip to content

Commit 88e7b9b

Browse files
committed
ir analysis for coro_id and coro_alloc
See #727
1 parent 37c07d4 commit 88e7b9b

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

src/ir.cpp

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16807,11 +16807,22 @@ static TypeTableEntry *ir_analyze_instruction_cancel(IrAnalyze *ira, IrInstructi
1680716807
}
1680816808

1680916809
static TypeTableEntry *ir_analyze_instruction_coro_id(IrAnalyze *ira, IrInstructionCoroId *instruction) {
16810-
zig_panic("TODO ir_analyze_instruction_coro_id");
16810+
IrInstruction *result = ir_build_coro_id(&ira->new_irb, instruction->base.scope, instruction->base.source_node);
16811+
ir_link_new_instruction(result, &instruction->base);
16812+
result->value.type = ira->codegen->builtin_types.entry_usize;
16813+
return result->value.type;
1681116814
}
1681216815

1681316816
static TypeTableEntry *ir_analyze_instruction_coro_alloc(IrAnalyze *ira, IrInstructionCoroAlloc *instruction) {
16814-
zig_panic("TODO ir_analyze_instruction_coro_alloc");
16817+
IrInstruction *coro_id = instruction->coro_id->other;
16818+
if (type_is_invalid(coro_id->value.type))
16819+
return ira->codegen->builtin_types.entry_invalid;
16820+
16821+
IrInstruction *result = ir_build_coro_alloc(&ira->new_irb, instruction->base.scope, instruction->base.source_node,
16822+
coro_id);
16823+
ir_link_new_instruction(result, &instruction->base);
16824+
result->value.type = ira->codegen->builtin_types.entry_bool;
16825+
return result->value.type;
1681516826
}
1681616827

1681716828
static TypeTableEntry *ir_analyze_instruction_coro_size(IrAnalyze *ira, IrInstructionCoroSize *instruction) {

0 commit comments

Comments
 (0)