Something went wrong. Try again.
🌱 A minimal programming language and compiler. git.urbach.dev/cli/q
high-performance programming-language compiler
Something went wrong. Try again.
12345678910111213141516171819202122232425262728293031323334353637383940package core
import ( "git.urbach.dev/cli/q/src/errors" "git.urbach.dev/cli/q/src/ssa" "git.urbach.dev/cli/q/src/types")
// verifyDeallocation verifies that all resources have been deallocated.func (f *Function) verifyDeallocation() error { for exitBlock := range f.ExitBlocks { for _, value := range exitBlock.Identifiers.After.Raw() { if value == nil { continue }
_, isParam := value.(*ssa.Parameter)
if isParam { continue }
resource, isResource := value.Type().(*types.Resource)
if !isResource { continue }
phi, isPhi := value.(*ssa.Phi)
if isPhi && phi.IsPartiallyUndefined() { return errors.New(&ResourcePartiallyConsumed{TypeName: resource.Name()}, f.File, phi.FirstDefined().(errors.Source)) }
return errors.New(&ResourceNotConsumed{TypeName: resource.Name()}, f.File, value.(errors.Source)) } }
return nil}