Skip to content

Commit f6e99b1

Browse files
[MOD] XQuery, nondeterminism: fn:void
1 parent 8766e9f commit f6e99b1

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

  • basex-core/src/main/java/org/basex/query/func/fn

basex-core/src/main/java/org/basex/query/func/fn/FnVoid.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,16 @@
1717
* @author Christian Gruen
1818
*/
1919
public final class FnVoid extends StandardFunc {
20+
/** Nondeterministic input. */
21+
private boolean ndt;
22+
2023
@Override
2124
public Item item(final QueryContext qc, final InputInfo ii) throws QueryException {
2225
final Expr input = arg(0);
2326
final boolean skip = toBooleanOrFalse(arg(1), qc);
2427

2528
// ensure that nondeterministic input will be evaluated
26-
if(!skip || input.has(Flag.NDT)) {
29+
if(!skip || ndt) {
2730
for(final Iter iter = input.iter(qc); qc.next(iter) != null;);
2831
}
2932
return Empty.VALUE;
@@ -32,7 +35,8 @@ public Item item(final QueryContext qc, final InputInfo ii) throws QueryExceptio
3235
@Override
3336
protected Expr opt(final CompileContext cc) throws QueryException {
3437
final Expr input = arg(0);
35-
if(input.has(Flag.NDT)) {
38+
ndt = input.has(Flag.NDT);
39+
if(ndt) {
3640
if(input.size() == 0) return input;
3741
} else if(defined(1) && arg(1) instanceof Value && toBoolean(arg(1), cc.qc)) {
3842
return Empty.VALUE;

0 commit comments

Comments
 (0)