...
1
16
17 package decoder
18
19 import (
20 `encoding`
21 `encoding/base64`
22 `encoding/json`
23 `reflect`
24 `unsafe`
25
26 `github.com/bytedance/sonic/internal/rt`
27 )
28
29 var (
30 byteType = reflect.TypeOf(byte(0))
31 intType = reflect.TypeOf(int(0))
32 int8Type = reflect.TypeOf(int8(0))
33 int16Type = reflect.TypeOf(int16(0))
34 int32Type = reflect.TypeOf(int32(0))
35 int64Type = reflect.TypeOf(int64(0))
36 uintType = reflect.TypeOf(uint(0))
37 uint8Type = reflect.TypeOf(uint8(0))
38 uint16Type = reflect.TypeOf(uint16(0))
39 uint32Type = reflect.TypeOf(uint32(0))
40 uint64Type = reflect.TypeOf(uint64(0))
41 float32Type = reflect.TypeOf(float32(0))
42 float64Type = reflect.TypeOf(float64(0))
43 stringType = reflect.TypeOf("")
44 bytesType = reflect.TypeOf([]byte(nil))
45 jsonNumberType = reflect.TypeOf(json.Number(""))
46 base64CorruptInputError = reflect.TypeOf(base64.CorruptInputError(0))
47 )
48
49 var (
50 errorType = reflect.TypeOf((*error)(nil)).Elem()
51 jsonUnmarshalerType = reflect.TypeOf((*json.Unmarshaler)(nil)).Elem()
52 encodingTextUnmarshalerType = reflect.TypeOf((*encoding.TextUnmarshaler)(nil)).Elem()
53 )
54
55 func rtype(t reflect.Type) (*rt.GoItab, *rt.GoType) {
56 p := (*rt.GoIface)(unsafe.Pointer(&t))
57 return p.Itab, (*rt.GoType)(p.Value)
58 }
59
View as plain text