Lines Matching refs:w
19 w := writer{ww}
22 w.typ(v.Type())
23 w.string("(nil)")
26 w.do(v, false)
30 w io.Writer member
33 func (w *writer) do(v reflect.Value, sliceElem bool) {
36 w.doPtr(v, sliceElem)
39 w.string("nil")
41 w.do(v.Elem(), false)
44 w.doSlice(v)
46 w.doStruct(v, sliceElem)
49 w.string("true")
51 w.string("false")
54 fmt.Fprintf(w.w, "%v", v.Int())
56 fmt.Fprintf(w.w, "%v", v.Uint())
58 fmt.Fprintf(w.w, "%q", v.String())
66 func (w *writer) doPtr(v reflect.Value, sliceElem bool) {
68 w.string("nil")
72 w.byte('&')
78 w.do(v.Elem(), sliceElem)
81 func (w *writer) doSlice(v reflect.Value) {
83 w.string("nil")
86 w.typ(v.Type())
90 w.string("{\n")
92 w.do(v.Index(i), true)
93 w.string(",\n")
95 w.byte('}')
99 w.byte('{')
102 w.byte(',')
104 w.do(v.Index(i), true)
106 w.byte('}')
109 func (w *writer) doStruct(v reflect.Value, sliceElem bool) {
111 w.string(v.Type().Name())
113 w.byte('{')
121 w.byte(',')
123 w.string(v.Type().Field(i).Name)
124 w.byte(':')
125 w.do(f, false)
128 w.byte('}')
131 func (w *writer) typ(t reflect.Type) {
134 w.byte('*')
135 w.typ(t.Elem())
137 w.string("[]")
138 w.typ(t.Elem())
140 w.string(t.Name())
144 func (w *writer) string(v string) {
145 io.WriteString(w.w, v)
148 func (w *writer) byte(v byte) {
149 if bw, ok := w.w.(io.ByteWriter); ok {
152 w.w.Write([]byte{v})