(args ...vector.Any)
| 168 | } |
| 169 | |
| 170 | func (t *TypeName) Call(args ...vector.Any) vector.Any { |
| 171 | vec := vector.Under(args[0]) |
| 172 | if vec.Type() != super.TypeString { |
| 173 | return vector.NewWrappedError(t.sctx, "typename: argument must be a string", args[0]) |
| 174 | } |
| 175 | var errs []uint32 |
| 176 | out := vector.NewTypeValueEmpty(0) |
| 177 | for i := range vec.Len() { |
| 178 | s := vector.StringValue(vec, i) |
| 179 | if typ := t.sctx.LookupTypeDef(s); typ == nil { |
| 180 | errs = append(errs, i) |
| 181 | } else { |
| 182 | out.Append(t.sctx.LookupTypeValue(typ).Bytes()) |
| 183 | } |
| 184 | } |
| 185 | if len(errs) > 0 { |
| 186 | return vector.Combine(out, errs, vector.NewMissing(t.sctx, uint32(len(errs)))) |
| 187 | } |
| 188 | return out |
| 189 | } |
| 190 | |
| 191 | type Error struct { |
| 192 | sctx *super.Context |
nothing calls this directly
no test coverage detected