MCPcopy Create free account
hub / github.com/akyoto/q / makeStruct

Method makeStruct

src/core/makeStruct.go:10–26  ·  view source on GitHub ↗

makeStruct creates a struct and saves a reference to it for every field. This is later used in dead code removal to know if a value is part of a partially used struct.

(typ types.Type, fields []ssa.Value, source ssa.Source)

Source from the content-addressed store, hash-verified

8// makeStruct creates a struct and saves a reference to it for every field.
9// This is later used in dead code removal to know if a value is part of a partially used struct.
10func (f *Function) makeStruct(typ types.Type, fields []ssa.Value, source ssa.Source) *ssa.Struct {
11 structure := &ssa.Struct{
12 Typ: typ,
13 Arguments: fields,
14 Source: source,
15 }
16
17 if f.valueToStruct == nil {
18 f.valueToStruct = map[ssa.Value]*ssa.Struct{}
19 }
20
21 for _, value := range fields {
22 f.valueToStruct[value] = structure
23 }
24
25 return structure
26}

Callers 7

loadFieldsMethod · 0.95
composeStructMethod · 0.95
makeSliceMethod · 0.95
makeStructFromTupleMethod · 0.95
callMethod · 0.95
evaluateStringMethod · 0.95
evaluateSliceMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected