Skip to content
Myr

Revert "Allow .[-1] in path expressions"

Before adoption: this commit came in with the history the project adopted, so no landing records it.

This reverts commit 086a156ec389de167edc72e8bd1752984b117349. This commit leads to negative indexing wraps twice.

authored by itchyny · committed by Nico Williams · parent 4cf1408 · Browse files · 1 file+0 added−8 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+0 added−8 removed

  • other:+0 added−8 removed

1 file+0 added−8 removed

modified:src/execute.c-8 removed
692 unmodified lines
693 jv_dump_string_trunc(t, objbuf, sizeof(objbuf)));694 set_error(jq, jv_invalid_with_msg(msg));695 goto do_backtrack;696 }697 // $array | .[-1]698 if (jv_get_kind(k) == JV_KIND_NUMBER && jv_get_kind(t) == JV_KIND_ARRAY) {699 int idx = jv_number_value(k);700 if (idx < 0) {701 jv_free(k);702 k = jv_number(jv_array_length(jv_copy(t)) + idx);703 }704 }697 jv v = jv_get(t, jv_copy(k));698 if (jv_is_valid(v)) {699 path_append(jq, k, jv_copy(v));700 stack_push(jq, v);
644 unmodified lines