MCPcopy Create free account
hub / github.com/blues/note / value

Method value

jsonxt/decode.go:363–400  ·  view source on GitHub ↗

value consumes a JSON value from d.data[d.off-1:], decoding into v, and reads the following byte ahead. If v is invalid, the value is discarded. The first byte of the value has been read already.

(v reflect.Value)

Source from the content-addressed store, hash-verified

361// reads the following byte ahead. If v is invalid, the value is discarded.
362// The first byte of the value has been read already.
363func (d *decodeState) value(v reflect.Value) error {
364 switch d.opcode {
365 default:
366 panic(phasePanicMsg)
367
368 case scanBeginArray:
369 if v.IsValid() {
370 if err := d.array(v); err != nil {
371 return err
372 }
373 } else {
374 d.skip()
375 }
376 d.scanNext()
377
378 case scanBeginObject:
379 if v.IsValid() {
380 if err := d.object(v); err != nil {
381 return err
382 }
383 } else {
384 d.skip()
385 }
386 d.scanNext()
387
388 case scanBeginLiteral:
389 // All bytes inside literal return scanContinue op code.
390 start := d.readIndex()
391 d.scanWhile(scanContinue)
392
393 if v.IsValid() {
394 if err := d.literalStore(d.data[start:d.readIndex()], v, false); err != nil {
395 return err
396 }
397 }
398 }
399 return nil
400}
401
402type unquotedValue struct{}
403

Callers 3

unmarshalMethod · 0.95
arrayMethod · 0.95
objectMethod · 0.95

Calls 7

arrayMethod · 0.95
skipMethod · 0.95
scanNextMethod · 0.95
objectMethod · 0.95
readIndexMethod · 0.95
scanWhileMethod · 0.95
literalStoreMethod · 0.95

Tested by

no test coverage detected