| ... | ... | @@ -26660,13 +26660,12 @@ fn prepareSimplePanic(sema: *Sema, block: *Block) !void { |
| 26660 | 26660 | // decl_index may be an alias; we must find the decl that actually |
| 26661 | 26661 | // owns the function. |
| 26662 | 26662 | try sema.ensureDeclAnalyzed(decl_index); |
| 26663 | | const tv = try mod.declPtr(decl_index).typedValue(mod); |
| 26663 | const fn_val = try mod.declPtr(decl_index).valueOrFail(); |
| 26664 | 26664 | try sema.declareDependency(.{ .decl_val = decl_index }); |
| 26665 | | assert(tv.ty.zigTypeTag(mod) == .Fn); |
| 26666 | | assert(try sema.fnHasRuntimeBits(tv.ty)); |
| 26667 | | const func_index = tv.val.toIntern(); |
| 26668 | | try mod.ensureFuncBodyAnalysisQueued(func_index); |
| 26669 | | mod.panic_func_index = func_index; |
| 26665 | assert(fn_val.typeOf(mod).zigTypeTag(mod) == .Fn); |
| 26666 | assert(try sema.fnHasRuntimeBits(fn_val.typeOf(mod))); |
| 26667 | try mod.ensureFuncBodyAnalysisQueued(fn_val.toIntern()); |
| 26668 | mod.panic_func_index = fn_val.toIntern(); |
| 26670 | 26669 | } |
| 26671 | 26670 | |
| 26672 | 26671 | if (mod.null_stack_trace == .none) { |
| ... | ... | @@ -32449,8 +32448,8 @@ fn analyzeDeclRefInner(sema: *Sema, decl_index: InternPool.DeclIndex, analyze_fn |
| 32449 | 32448 | const mod = sema.mod; |
| 32450 | 32449 | try sema.ensureDeclAnalyzed(decl_index); |
| 32451 | 32450 | |
| 32452 | | const decl_tv = try mod.declPtr(decl_index).typedValue(mod); |
| 32453 | | const owner_decl = mod.declPtr(switch (mod.intern_pool.indexToKey(decl_tv.val.toIntern())) { |
| 32451 | const decl_val = try mod.declPtr(decl_index).valueOrFail(); |
| 32452 | const owner_decl = mod.declPtr(switch (mod.intern_pool.indexToKey(decl_val.toIntern())) { |
| 32454 | 32453 | .variable => |variable| variable.decl, |
| 32455 | 32454 | .extern_func => |extern_func| extern_func.decl, |
| 32456 | 32455 | .func => |func| func.owner_decl, |
| ... | ... | @@ -32459,10 +32458,10 @@ fn analyzeDeclRefInner(sema: *Sema, decl_index: InternPool.DeclIndex, analyze_fn |
| 32459 | 32458 | // TODO: if this is a `decl_ref` of a non-variable decl, only depend on decl type |
| 32460 | 32459 | try sema.declareDependency(.{ .decl_val = decl_index }); |
| 32461 | 32460 | const ptr_ty = try sema.ptrType(.{ |
| 32462 | | .child = decl_tv.ty.toIntern(), |
| 32461 | .child = decl_val.typeOf(mod).toIntern(), |
| 32463 | 32462 | .flags = .{ |
| 32464 | 32463 | .alignment = owner_decl.alignment, |
| 32465 | | .is_const = if (decl_tv.val.getVariable(mod)) |variable| variable.is_const else true, |
| 32464 | .is_const = if (decl_val.getVariable(mod)) |variable| variable.is_const else true, |
| 32466 | 32465 | .address_space = owner_decl.@"addrspace", |
| 32467 | 32466 | }, |
| 32468 | 32467 | }); |
| ... | ... | @@ -32478,12 +32477,10 @@ fn analyzeDeclRefInner(sema: *Sema, decl_index: InternPool.DeclIndex, analyze_fn |
| 32478 | 32477 | fn maybeQueueFuncBodyAnalysis(sema: *Sema, decl_index: InternPool.DeclIndex) !void { |
| 32479 | 32478 | const mod = sema.mod; |
| 32480 | 32479 | const decl = mod.declPtr(decl_index); |
| 32481 | | const tv = try decl.typedValue(mod); |
| 32482 | | if (tv.ty.zigTypeTag(mod) != .Fn) return; |
| 32483 | | if (!try sema.fnHasRuntimeBits(tv.ty)) return; |
| 32484 | | const func_index = tv.val.toIntern(); |
| 32485 | | if (!mod.intern_pool.isFuncBody(func_index)) return; // undef or extern function |
| 32486 | | try mod.ensureFuncBodyAnalysisQueued(func_index); |
| 32480 | const decl_val = try decl.valueOrFail(); |
| 32481 | if (!mod.intern_pool.isFuncBody(decl_val.toIntern())) return; |
| 32482 | if (!try sema.fnHasRuntimeBits(decl_val.typeOf(mod))) return; |
| 32483 | try mod.ensureFuncBodyAnalysisQueued(decl_val.toIntern()); |
| 32487 | 32484 | } |
| 32488 | 32485 | |
| 32489 | 32486 | fn analyzeRef( |
| ... | ... | @@ -39049,7 +39046,6 @@ fn sliceToIpString( |
| 39049 | 39046 | reason: NeededComptimeReason, |
| 39050 | 39047 | ) CompileError!InternPool.NullTerminatedString { |
| 39051 | 39048 | const zcu = sema.mod; |
| 39052 | | const ip = &zcu.intern_pool; |
| 39053 | 39049 | const slice_ty = slice_val.typeOf(zcu); |
| 39054 | 39050 | assert(slice_ty.isSlice(zcu)); |
| 39055 | 39051 | assert(slice_ty.childType(zcu).toIntern() == .u8_type); |