diff options
| author | Veikka Tuominen <git@vexu.eu> | 2022-11-11 18:54:41 +0200 |
|---|---|---|
| committer | Veikka Tuominen <git@vexu.eu> | 2022-11-12 15:41:29 +0200 |
| commit | a760ce598c7656f7582d8305582e374af68254d9 (patch) | |
| tree | 71c72be4fd51f4e3e9d911bba7cab51431baaa51 /src | |
| parent | d42f4abb9dc906ef20b622656c7672cb7df02096 (diff) | |
| download | zig-a760ce598c7656f7582d8305582e374af68254d9.tar.gz zig-a760ce598c7656f7582d8305582e374af68254d9.zip | |
Sema: ensure that `!is_comptime and !is_typeof` implies `sema.func != null`
Closes #13481
Diffstat (limited to 'src')
| -rw-r--r-- | src/Sema.zig | 7 |
1 files changed, 1 insertions, 6 deletions
diff --git a/src/Sema.zig b/src/Sema.zig index c393dab598..f40f36e511 100644 --- a/src/Sema.zig +++ b/src/Sema.zig @@ -6333,6 +6333,7 @@ fn analyzeCall( .instructions = .{}, .label = null, .inlining = &inlining, + .is_typeof = block.is_typeof, .is_comptime = is_comptime_call, .comptime_reason = comptime_reason, .error_return_trace_index = block.error_return_trace_index, @@ -16532,9 +16533,6 @@ fn zirSaveErrRetIndex(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileE // This is only relevant at runtime. if (block.is_comptime or block.is_typeof) return; - // This is only relevant within functions. - if (sema.func == null) return; - const save_index = inst_data.operand == .none or b: { const operand = try sema.resolveInst(inst_data.operand); const operand_ty = sema.typeOf(operand); @@ -27505,9 +27503,6 @@ fn analyzeLoad( if (try sema.pointerDeref(block, src, ptr_val, ptr_ty)) |elem_val| { return sema.addConstant(elem_ty, elem_val); } - if (block.is_typeof) { - return sema.addConstUndef(elem_ty); - } } return block.addTyOp(.load, elem_ty, ptr); |
