• Home
  • Raw
  • Download

Lines Matching refs:opts

56 func (opts formatOptions) WithDiffMode(d diffMode) formatOptions {
57 opts.DiffMode = d
58 return opts
60 func (opts formatOptions) WithTypeMode(t typeMode) formatOptions {
61 opts.TypeMode = t
62 return opts
64 func (opts formatOptions) WithVerbosity(level int) formatOptions {
65 opts.VerbosityLevel = level
66 opts.LimitVerbosity = true
67 return opts
69 func (opts formatOptions) verbosity() uint {
71 case opts.VerbosityLevel < 0:
73 case opts.VerbosityLevel > 16:
76 return uint(opts.VerbosityLevel)
84 func verbosityPreset(opts formatOptions, i int) formatOptions {
85 opts.VerbosityLevel = int(opts.verbosity()) + 2*i
87 opts.AvoidStringer = true
90 opts.PrintAddresses = true
91 opts.QualifiedNames = true
93 return opts
98 func (opts formatOptions) FormatDiff(v *valueNode, ptrs *pointerReferences) (out textNode) {
99 if opts.DiffMode == diffIdentical {
100 opts = opts.WithVerbosity(1)
101 } else if opts.verbosity() < 3 {
102 opts = opts.WithVerbosity(3)
107 if opts.CanFormatDiffSlice(v) {
108 return opts.FormatDiffSlice(v)
121 switch opts.DiffMode {
125 outx := opts.FormatValue(v.ValueX, parentKind, ptrs)
126 outy := opts.FormatValue(v.ValueY, parentKind, ptrs)
137 assert(opts.DiffMode == diffUnknown)
139 outx := opts.WithTypeMode(elideType).FormatValue(v.ValueX, parentKind, ptrs)
140 outy := opts.WithTypeMode(elideType).FormatValue(v.ValueY, parentKind, ptrs)
142 opts2 := verbosityPreset(opts, i).WithTypeMode(elideType)
152 return opts.WithTypeMode(emitType).FormatType(v.Type, list)
154 return opts.FormatValue(v.ValueX, parentKind, ptrs)
156 return opts.FormatValue(v.ValueY, parentKind, ptrs)
164 ptrRefs := ptrs.PushPair(v.ValueX, v.ValueY, opts.DiffMode, true)
171 out := opts.WithTypeMode(emitType).FormatDiff(v.Value, ptrs)
173 return opts.FormatType(v.Type, out)
177 out = opts.formatDiffList(v.Records, k, ptrs)
178 out = opts.FormatType(v.Type, out)
181 ptrRefs := ptrs.PushPair(v.ValueX, v.ValueY, opts.DiffMode, false)
184 out = opts.formatDiffList(v.Records, k, ptrs)
186 out = opts.FormatType(v.Type, out)
189 ptrRefs := ptrs.PushPair(v.ValueX, v.ValueY, opts.DiffMode, false)
192 out = opts.FormatDiff(v.Value, ptrs)
196 out = opts.WithTypeMode(emitType).FormatDiff(v.Value, ptrs)
204 func (opts formatOptions) formatDiffList(recs []reportRecord, k reflect.Kind, ptrs *pointerReferenc…
211 opts = opts.WithTypeMode(autoType)
215 opts = opts.WithTypeMode(elideType)
219 opts = opts.WithTypeMode(elideType)
224 if opts.LimitVerbosity {
225 if opts.DiffMode == diffIdentical {
226 maxLen = ((1 << opts.verbosity()) >> 1) << 2 // 0, 4, 8, 16, 32, etc...
228 maxLen = (1 << opts.verbosity()) << 1 // 2, 4, 8, 16, 32, 64, etc...
230 opts.VerbosityLevel--
234 switch opts.DiffMode {
247 switch opts.DiffMode {
267 if out := opts.FormatDiff(r.Value, ptrs); out != nil {
315 out := opts.WithDiffMode(diffIdentical).FormatDiff(r.Value, ptrs)
327 out := opts.WithDiffMode(diffIdentical).FormatDiff(r.Value, ptrs)
338 case opts.CanFormatDiffSlice(r.Value):
339 out := opts.FormatDiffSlice(r.Value)
343 outx := opts.WithDiffMode(diffRemoved).FormatDiff(r.Value, ptrs)
344 outy := opts.WithDiffMode(diffInserted).FormatDiff(r.Value, ptrs)
346 opts2 := verbosityPreset(opts, i)
359 out := opts.FormatDiff(r.Value, ptrs)