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

Method asLet

basex-core/src/main/java/org/basex/query/expr/gflwor/For.java:180–192  ·  view source on GitHub ↗

Tries to convert this for loop into a let binding. @param clauses FLWOR clauses @param p position @param cc compilation context @return true if the clause was converted, false otherwise @throws QueryException query exception

(final List<Clause> clauses, final int p, final CompileContext cc)

Source from the content-addressed store, hash-verified

178 * @throws QueryException query exception
179 */
180 boolean asLet(final List<Clause> clauses, final int p, final CompileContext cc)
181 throws QueryException {
182
183 if(!expr.seqType().one()) return false;
184 clauses.set(p, new Let(var, expr).optimize(cc));
185 if(score != null) {
186 clauses.add(p + 1, new Let(score, new VarRef(info(), var).optimize(cc), true).optimize(cc));
187 }
188 if(pos != null) {
189 clauses.add(p + 1, new Let(pos, Itr.ONE).optimize(cc));
190 }
191 return true;
192 }
193
194 /**
195 * Removes a variable reference.

Callers 1

forToLetMethod · 0.80

Calls 6

oneMethod · 0.80
seqTypeMethod · 0.65
setMethod · 0.65
addMethod · 0.65
infoMethod · 0.65
optimizeMethod · 0.45

Tested by

no test coverage detected