Change order of evaluation for certain indexing operations.

'.foo[.bar]' used to parse like '.foo | .bar as $b | .[$b]',
now it parses like '.bar as $b | .foo | .[$b]'.
This commit is contained in:
Stephen Dolan committed 2012-12-07 00:28:11 +00:00
1 parent c0a2f1ab47
commit 84026f0513
2 files changed
+5 -1

No files matched your search

+1 -1
View File
@@ -133,7 +133,7 @@ static block gen_dictpair(block k, block v) {
}
static block gen_index(block obj, block key) {
return BLOCK(obj, gen_subexp(key), gen_op_simple(INDEX));
return BLOCK(gen_subexp(key), obj, gen_op_simple(INDEX));
}
static block gen_binop(block a, block b, int op) {
+4
View File
@@ -464,3 +464,7 @@ unique
[min,max,min_by(.),max_by(.)]
[]
[null,null,null,null]
.foo[.baz]
{"foo":{"bar":4},"baz":"bar"}
4