diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2019-08-22 14:46:26 -0400 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2019-08-22 14:46:26 -0400 |
| commit | 26b79ac90ee8cf17f28b0584c773be759e0e49bd (patch) | |
| tree | 78fc31e987e4d1ef8ee56d2da775ef1cea9b52d9 /src/ir.cpp | |
| parent | 0d6a6c76eabcd020c5f58dc4667766b0e2756dfa (diff) | |
| download | zig-26b79ac90ee8cf17f28b0584c773be759e0e49bd.tar.gz zig-26b79ac90ee8cf17f28b0584c773be759e0e49bd.zip | |
simple self-referential struct is working now
Diffstat (limited to 'src/ir.cpp')
| -rw-r--r-- | src/ir.cpp | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/src/ir.cpp b/src/ir.cpp index e64098be01..92b8598442 100644 --- a/src/ir.cpp +++ b/src/ir.cpp @@ -10814,10 +10814,6 @@ ConstExprValue *ir_eval_const_value(CodeGen *codegen, Scope *scope, AstNode *nod if (!allow_lazy) { if ((err = ir_resolve_lazy(codegen, node, result))) { - if (codegen->trace_err != nullptr) { - codegen->trace_err = add_error_note(codegen, codegen->trace_err, source_node, - buf_create_from_str("referenced here")); - } return &codegen->invalid_instruction->value; } } @@ -25429,7 +25425,7 @@ bool ir_has_side_effects(IrInstruction *instruction) { zig_unreachable(); } -Error ir_resolve_lazy(CodeGen *codegen, AstNode *source_node, ConstExprValue *val) { +static Error ir_resolve_lazy_raw(CodeGen *codegen, AstNode *source_node, ConstExprValue *val) { Error err; if (val->special != ConstValSpecialLazy) return ErrorNone; @@ -25491,3 +25487,15 @@ Error ir_resolve_lazy(CodeGen *codegen, AstNode *source_node, ConstExprValue *va } zig_unreachable(); } + +Error ir_resolve_lazy(CodeGen *codegen, AstNode *source_node, ConstExprValue *val) { + Error err; + if ((err = ir_resolve_lazy_raw(codegen, source_node, val))) { + if (codegen->trace_err != nullptr) { + codegen->trace_err = add_error_note(codegen, codegen->trace_err, source_node, + buf_create_from_str("referenced here")); + } + return err; + } + return ErrorNone; +} |
