| ... | ... | @@ -10112,6 +10112,13 @@ fn zirElemPtrLoad(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError |
| 10112 | 10112 | const extra = sema.code.extraData(Zir.Inst.Bin, inst_data.payload_index).data; |
| 10113 | 10113 | const array_ptr = try sema.resolveInst(extra.lhs); |
| 10114 | 10114 | const uncoerced_elem_index = try sema.resolveInst(extra.rhs); |
| 10115 | if (try sema.resolveDefinedValue(block, src, array_ptr)) |array_ptr_val| { |
| 10116 | const array_ptr_ty = sema.typeOf(array_ptr); |
| 10117 | if (try sema.pointerDeref(block, src, array_ptr_val, array_ptr_ty)) |array_val| { |
| 10118 | const array: Air.Inst.Ref = .fromValue(array_val); |
| 10119 | return elemVal(sema, block, src, array, uncoerced_elem_index, elem_index_src, true); |
| 10120 | } |
| 10121 | } |
| 10115 | 10122 | const elem_index = try sema.coerce(block, .usize, uncoerced_elem_index, elem_index_src); |
| 10116 | 10123 | const elem_ptr = try elemPtr(sema, block, src, array_ptr, elem_index, elem_index_src, false, true); |
| 10117 | 10124 | return analyzeLoad(sema, block, src, elem_ptr, elem_index_src); |