diff options
| author | Tadeo Kondrak <me@tadeo.ca> | 2020-04-28 11:14:47 -0600 |
|---|---|---|
| committer | Tadeo Kondrak <me@tadeo.ca> | 2020-05-02 14:39:27 -0600 |
| commit | 1696e943acd67119104f303467c0e26eecb94544 (patch) | |
| tree | 0a152f64456fa75fff0776e54732f6beec34d6ee /src/ir.cpp | |
| parent | b7914d901c8c5761457a4774858f1004febc2d3a (diff) | |
| download | zig-1696e943acd67119104f303467c0e26eecb94544.tar.gz zig-1696e943acd67119104f303467c0e26eecb94544.zip | |
Implement @typeInfo for @Frame()
Closes https://github.com/ziglang/zig/issues/3066
Diffstat (limited to 'src/ir.cpp')
| -rw-r--r-- | src/ir.cpp | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/src/ir.cpp b/src/ir.cpp index f37f91088a..0111a33f34 100644 --- a/src/ir.cpp +++ b/src/ir.cpp @@ -25166,9 +25166,18 @@ static Error ir_make_type_info_value(IrAnalyze *ira, IrInst* source_instr, ZigTy break; } case ZigTypeIdFnFrame: - ir_add_error(ira, source_instr, - buf_sprintf("compiler bug: TODO @typeInfo for async function frames. https://github.com/ziglang/zig/issues/3066")); - return ErrorSemanticAnalyzeFail; + { + result = ira->codegen->pass1_arena->create<ZigValue>(); + result->special = ConstValSpecialStatic; + result->type = ir_type_info_get_type(ira, "Frame", nullptr); + ZigValue **fields = alloc_const_vals_ptrs(ira->codegen, 1); + result->data.x_struct.fields = fields; + ZigFn *fn = type_entry->data.frame.fn; + // function: var + ensure_field_index(result->type, "function", 0); + fields[0] = create_const_fn(ira->codegen, fn); + break; + } } assert(result != nullptr); |
