MCPcopy Create free account
hub / github.com/DNAProject/DNA / cloneStruct

Function cloneStruct

vm/neovm/types/struct_value.go:61–79  ·  view source on GitHub ↗
(s *StructValue, length *int)

Source from the content-addressed store, hash-verified

59}
60
61func cloneStruct(s *StructValue, length *int) (*StructValue, error) {
62 if *length > MAX_CLONE_LENGTH {
63 return nil, fmt.Errorf("%s", "over max struct clone length")
64 }
65 var arr []VmValue
66 for _, v := range s.Data {
67 *length++
68 if temp, err := v.AsStructValue(); err == nil {
69 vc, err := cloneStruct(temp, length)
70 if err != nil {
71 return nil, err
72 }
73 arr = append(arr, VmValueFromStructVal(vc))
74 } else {
75 arr = append(arr, v)
76 }
77 }
78 return &StructValue{Data: arr}, nil
79}

Callers 1

CloneMethod · 0.85

Calls 3

VmValueFromStructValFunction · 0.85
ErrorfMethod · 0.80
AsStructValueMethod · 0.80

Tested by

no test coverage detected