(final CompileContext cc)
| 37 | } |
| 38 | |
| 39 | @Override |
| 40 | public final Expr optimize(final CompileContext cc) throws QueryException { |
| 41 | Expr expr = opt(cc); |
| 42 | if(expr == null) { |
| 43 | final int el = exprs.length; |
| 44 | if(el == 0) return Empty.VALUE; |
| 45 | if(el == 1) return cc.function(Function.DISTINCT_ORDERED_NODES, info, exprs[0]); |
| 46 | // try to merge operands |
| 47 | expr = mergePaths(cc); |
| 48 | if(expr == null) expr = mergeFilters(cc); |
| 49 | } |
| 50 | if(expr != null) return cc.replaceWith(this, expr); |
| 51 | |
| 52 | iterative = ((Checks<Expr>) Expr::ddo).all(exprs); |
| 53 | return this; |
| 54 | } |
| 55 | |
| 56 | /** |
| 57 | * Performs function specific optimizations. |
no test coverage detected