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.
1234567891011121314151617181920212223242526package core
import ( "git.urbach.dev/cli/q/src/ssa" "git.urbach.dev/cli/q/src/types")
// decomposeSlice decomposes a slices to its pointer, type and length.func (f *Function) decomposeSlice(addressValue ssa.Value) (ssa.Value, types.Type, ssa.Value, error) { switch addressType := types.Unwrap(addressValue.Type()).(type) { case *types.Struct: structure, isStructure := addressValue.(*ssa.Struct)
if !isStructure { panic("not implemented") }
pointer := structure.Arguments[0] length := structure.Arguments[1] return pointer, pointer.Type(), length, nil case *types.Pointer: return addressValue, addressType, nil, nil default: panic("not implemented") }}