(r *rec, path field.Path)
| 33 | } |
| 34 | |
| 35 | func addPath(r *rec, path field.Path) error { |
| 36 | for k, name := range path { |
| 37 | idx := slices.Index(r.paths, name) |
| 38 | if k == len(path)-1 { |
| 39 | if idx > -1 { |
| 40 | return &super.DuplicateFieldError{Name: path.String()} |
| 41 | } |
| 42 | r.paths = append(r.paths, path[k]) |
| 43 | r.recs = append(r.recs, nil) |
| 44 | return nil |
| 45 | } |
| 46 | if idx == -1 { |
| 47 | idx = len(r.paths) |
| 48 | r.paths = append(r.paths, name) |
| 49 | r.recs = append(r.recs, &rec{}) |
| 50 | } |
| 51 | if r.recs[idx] == nil { |
| 52 | return &super.DuplicateFieldError{Name: path[:k+1].String()} |
| 53 | } |
| 54 | r = r.recs[idx] |
| 55 | } |
| 56 | return nil |
| 57 | } |
| 58 | |
| 59 | func (r *rec) build(sctx *super.Context, leafs []Any) (*Record, []Any) { |
| 60 | var fields []super.Field |
no test coverage detected