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/analyze.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/analyze.cpp')
| -rw-r--r-- | src/analyze.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/analyze.cpp b/src/analyze.cpp index d170273808..5eb0205dfb 100644 --- a/src/analyze.cpp +++ b/src/analyze.cpp @@ -6021,6 +6021,19 @@ ZigValue *create_const_null(CodeGen *g, ZigType *type) { return const_val; } +void init_const_fn(ZigValue *const_val, ZigFn *fn) { + const_val->special = ConstValSpecialStatic; + const_val->type = fn->type_entry; + const_val->data.x_ptr.special = ConstPtrSpecialFunction; + const_val->data.x_ptr.data.fn.fn_entry = fn; +} + +ZigValue *create_const_fn(CodeGen *g, ZigFn *fn) { + ZigValue *const_val = g->pass1_arena->create<ZigValue>(); + init_const_fn(const_val, fn); + return const_val; +} + void init_const_float(ZigValue *const_val, ZigType *type, double value) { const_val->special = ConstValSpecialStatic; const_val->type = type; |
