Skip to content

Commit 020cd9a

Browse files
[MOD] Lookups: support for JNodes
1 parent 1bac358 commit 020cd9a

1 file changed

Lines changed: 4 additions & 11 deletions

File tree

  • basex-core/src/main/java/org/basex/query/expr

basex-core/src/main/java/org/basex/query/expr/Lookup.java

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
import org.basex.query.util.*;
1111
import org.basex.query.value.*;
1212
import org.basex.query.value.item.*;
13+
import org.basex.query.value.node.*;
1314
import org.basex.query.value.type.*;
1415
import org.basex.query.var.*;
1516
import org.basex.util.*;
@@ -136,16 +137,6 @@ public Item next() throws QueryException {
136137
};
137138
}
138139

139-
@Override
140-
public Value value(final QueryContext qc) throws QueryException {
141-
final ValueBuilder vb = new ValueBuilder(qc);
142-
final Iter iter = exprs[0].iter(qc);
143-
for(Item item; (item = qc.next(iter)) != null;) {
144-
vb.add(valueFor(item, qc));
145-
}
146-
return vb.value(this);
147-
}
148-
149140
/**
150141
* Returns the looked up values for the specified input.
151142
* @param item input item
@@ -154,7 +145,9 @@ public Value value(final QueryContext qc) throws QueryException {
154145
* @throws QueryException query exception
155146
*/
156147
private Value valueFor(final Item item, final QueryContext qc) throws QueryException {
157-
if(!(item instanceof final XQStruct struct)) throw LOOKUP_X.get(info, item);
148+
Item it = item;
149+
if(it instanceof final JNode jnode) it = jnode.value.item(qc, info);
150+
if(!(it instanceof final XQStruct struct)) throw LOOKUP_X.get(info, it);
158151
final Expr keys = exprs[1];
159152

160153
// wildcard: add all values

0 commit comments

Comments
 (0)