diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2024-12-09 18:32:23 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-12-09 18:32:23 -0500 |
| commit | 7575f212128df84c8b86ee3c89d940313380d902 (patch) | |
| tree | fc060baccfbfbb24946779a0795c6c29d9d9bf92 /src/InternPool.zig | |
| parent | 8245d7fac0400d7e9de2a6fd4cfbc3609ad0f201 (diff) | |
| parent | 9f086f84f53de4eb23d96fe611c071f27405a660 (diff) | |
| download | zig-7575f212128df84c8b86ee3c89d940313380d902.tar.gz zig-7575f212128df84c8b86ee3c89d940313380d902.zip | |
Merge pull request #22157 from mlugg/astgen-error-lazy
compiler: allow semantic analysis of files with AstGen errors
Diffstat (limited to 'src/InternPool.zig')
| -rw-r--r-- | src/InternPool.zig | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/InternPool.zig b/src/InternPool.zig index bbbcb953f6..d0ed875d86 100644 --- a/src/InternPool.zig +++ b/src/InternPool.zig @@ -8616,6 +8616,16 @@ pub fn getFuncDecl( defer gop.deinit(); if (gop == .existing) { extra.mutate.len = prev_extra_len; + + const zir_body_inst_ptr = ip.funcDeclInfo(gop.existing).zirBodyInstPtr(ip); + if (zir_body_inst_ptr.* != key.zir_body_inst) { + // Since this function's `owner_nav` matches `key`, this *is* the function we're talking + // about. The only way it could have a different ZIR `func` instruction is if the old + // instruction has been lost and replaced with a new `TrackedInst.Index`. + assert(zir_body_inst_ptr.resolve(ip) == null); + zir_body_inst_ptr.* = key.zir_body_inst; + } + return gop.existing; } @@ -8762,6 +8772,16 @@ pub fn getFuncDeclIes( // An existing function type was found; undo the additions to our two arrays. items.mutate.len -= 4; extra.mutate.len = prev_extra_len; + + const zir_body_inst_ptr = ip.funcDeclInfo(func_gop.existing).zirBodyInstPtr(ip); + if (zir_body_inst_ptr.* != key.zir_body_inst) { + // Since this function's `owner_nav` matches `key`, this *is* the function we're talking + // about. The only way it could have a different ZIR `func` instruction is if the old + // instruction has been lost and replaced with a new `TrackedInst.Index`. + assert(zir_body_inst_ptr.resolve(ip) == null); + zir_body_inst_ptr.* = key.zir_body_inst; + } + return func_gop.existing; } func_gop.putTentative(func_index); |
