Add partial out-of-order check for field lookup
This commit is contained in:
parent
22b3ea93a8
commit
c5b44f44f9
|
@ -68,7 +68,13 @@ simdjson_warn_unused simdjson_really_inline simdjson_result<bool> value_iterator
|
||||||
// ^ (depth 0, index 2)
|
// ^ (depth 0, index 2)
|
||||||
// ```
|
// ```
|
||||||
//
|
//
|
||||||
if (!is_open()) { return false; }
|
if (!is_open()) {
|
||||||
|
// If we're past the end of the object, we're being iterated out of order.
|
||||||
|
// Note: this isn't perfect detection. It's possible the user is inside some other object; if so,
|
||||||
|
// this object iterator will blithely scan that object for fields.
|
||||||
|
if (_json_iter->depth() < depth() - 1) { return OUT_OF_ORDER_ITERATION; }
|
||||||
|
return false;
|
||||||
|
}
|
||||||
if (at_first_field()) {
|
if (at_first_field()) {
|
||||||
has_value = true;
|
has_value = true;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue