summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoritchyny <itchyny@cybozu.co.jp>2023-08-13 14:42:41 +0900
committerNico Williams <nico@cryptonector.com>2023-08-16 17:49:44 -0500
commitf85c9fcb78f89fa833f2d5a2cf26b54318e06e05 (patch)
tree84ba4b625390f5801aa1c2b892ff3c2c2844e3ba
parent4cf1408e0bbac8fc714b051fe420921905128efd (diff)
Revert "Allow .[-1] in path expressions"
This reverts commit 086a156ec389de167edc72e8bd1752984b117349. This commit leads to negative indexing wraps twice.
-rw-r--r--src/execute.c8
1 files changed, 0 insertions, 8 deletions
diff --git a/src/execute.c b/src/execute.c
index ae92c373..367819e8 100644
--- a/src/execute.c
+++ b/src/execute.c
@@ -694,14 +694,6 @@ jv jq_next(jq_state *jq) {
set_error(jq, jv_invalid_with_msg(msg));
goto do_backtrack;
}
- // $array | .[-1]
- if (jv_get_kind(k) == JV_KIND_NUMBER && jv_get_kind(t) == JV_KIND_ARRAY) {
- int idx = jv_number_value(k);
- if (idx < 0) {
- jv_free(k);
- k = jv_number(jv_array_length(jv_copy(t)) + idx);
- }
- }
jv v = jv_get(t, jv_copy(k));
if (jv_is_valid(v)) {
path_append(jq, k, jv_copy(v));