(sctx *super.Context, typ super.Type, v scode.Bytes)
| 215 | } |
| 216 | |
| 217 | func (w *Writer) encodePrimitive(sctx *super.Context, typ super.Type, v scode.Bytes) (any, error) { |
| 218 | if typ == super.TypeType { |
| 219 | typ, err := sctx.LookupByValue(v) |
| 220 | if err != nil { |
| 221 | return nil, err |
| 222 | } |
| 223 | if super.TypeID(typ) < super.IDTypeComplex { |
| 224 | return super.PrimitiveName(typ), nil |
| 225 | } |
| 226 | if named, ok := typ.(*super.TypeNamed); ok { |
| 227 | return named.Name, nil |
| 228 | } |
| 229 | return strconv.Itoa(super.TypeID(typ)), nil |
| 230 | } |
| 231 | if typ.ID() == super.IDString { |
| 232 | return string(v), nil |
| 233 | } |
| 234 | return sup.FormatPrimitive(typ, v), nil |
| 235 | } |
no test coverage detected