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)
| 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. |
| 10 | func (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 | } |
no outgoing calls
no test coverage detected