diff options
| author | Andrew Kelley <superjoe30@gmail.com> | 2018-02-22 09:36:58 -0500 |
|---|---|---|
| committer | Andrew Kelley <superjoe30@gmail.com> | 2018-02-22 09:36:58 -0500 |
| commit | 88e7b9bf80ef261be23ab5a427f6f10604225be1 (patch) | |
| tree | bf667d0675c3f2c5a99aaa79d2637fa46d37cf20 /src | |
| parent | 37c07d4f3f52f2227e86943cf84aebdc729684b7 (diff) | |
| download | zig-88e7b9bf80ef261be23ab5a427f6f10604225be1.tar.gz zig-88e7b9bf80ef261be23ab5a427f6f10604225be1.zip | |
ir analysis for coro_id and coro_alloc
See #727
Diffstat (limited to 'src')
| -rw-r--r-- | src/ir.cpp | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/src/ir.cpp b/src/ir.cpp index 2bac97849f..7235ad72f2 100644 --- a/src/ir.cpp +++ b/src/ir.cpp @@ -16807,11 +16807,22 @@ static TypeTableEntry *ir_analyze_instruction_cancel(IrAnalyze *ira, IrInstructi } static TypeTableEntry *ir_analyze_instruction_coro_id(IrAnalyze *ira, IrInstructionCoroId *instruction) { - zig_panic("TODO ir_analyze_instruction_coro_id"); + IrInstruction *result = ir_build_coro_id(&ira->new_irb, instruction->base.scope, instruction->base.source_node); + ir_link_new_instruction(result, &instruction->base); + result->value.type = ira->codegen->builtin_types.entry_usize; + return result->value.type; } static TypeTableEntry *ir_analyze_instruction_coro_alloc(IrAnalyze *ira, IrInstructionCoroAlloc *instruction) { - zig_panic("TODO ir_analyze_instruction_coro_alloc"); + IrInstruction *coro_id = instruction->coro_id->other; + if (type_is_invalid(coro_id->value.type)) + return ira->codegen->builtin_types.entry_invalid; + + IrInstruction *result = ir_build_coro_alloc(&ira->new_irb, instruction->base.scope, instruction->base.source_node, + coro_id); + ir_link_new_instruction(result, &instruction->base); + result->value.type = ira->codegen->builtin_types.entry_bool; + return result->value.type; } static TypeTableEntry *ir_analyze_instruction_coro_size(IrAnalyze *ira, IrInstructionCoroSize *instruction) { |
