MCPcopy Create free account
hub / github.com/BaseXdb/basex / optimize

Method optimize

basex-core/src/main/java/org/basex/query/expr/CmpIR.java:108–119  ·  view source on GitHub ↗
(final CompileContext cc)

Source from the content-addressed store, hash-verified

106 }
107
108 @Override
109 public Expr optimize(final CompileContext cc) throws QueryException {
110 expr = expr.simplifyFor(Simplify.NUMBER, cc);
111
112 final SeqType st = expr.seqType();
113 single = st.zeroOrOne() && !st.mayBeWrapped();
114
115 // position() = 1 to 2 → pos: 1, 2
116 if(Function.POSITION.is(expr)) return cc.replaceWith(this, IntPos.get(min, max, info));
117
118 return expr instanceof Value ? cc.preEval(this) : this;
119 }
120
121 @Override
122 public Bln item(final QueryContext qc, final InputInfo ii) throws QueryException {

Callers 1

getMethod · 0.45

Calls 8

zeroOrOneMethod · 0.95
mayBeWrappedMethod · 0.95
getMethod · 0.95
replaceWithMethod · 0.80
seqTypeMethod · 0.65
isMethod · 0.65
simplifyForMethod · 0.45
preEvalMethod · 0.45

Tested by

no test coverage detected