(s *StructValue, length *int)
| 59 | } |
| 60 | |
| 61 | func 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 | } |
no test coverage detected