aboutsummaryrefslogtreecommitdiffhomepage
path: root/internal/pkg/ir.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/pkg/ir.go')
-rw-r--r--internal/pkg/ir.go6
1 files changed, 6 insertions, 0 deletions
diff --git a/internal/pkg/ir.go b/internal/pkg/ir.go
index 41e75845..c93abc9e 100644
--- a/internal/pkg/ir.go
+++ b/internal/pkg/ir.go
@@ -432,6 +432,12 @@ func (e InvalidKindError) Error() string {
// register is not safe for concurrent use. register must not be called after
// the first instance of [Cache] has been opened.
func register(k Kind, f IRReadFunc) {
+ openMu.Lock()
+ defer openMu.Unlock()
+
+ if opened {
+ panic("attempting to register after open")
+ }
if _, ok := irArtifact[k]; ok {
panic("attempting to register " + strconv.Itoa(int(k)) + " twice")
}