Exemplo n.º 1
0
 @Override
 Expr opt(final QueryContext ctx, final VarScope scp) throws QueryException {
   if (sig == Function._UNIT_TEST_URIS || sig == Function._UNIT_TEST && expr.length == 0) {
     for (final StaticFunc fn : ctx.funcs.funcs()) {
       if (fn.compiled()) continue;
       final Ann ann = fn.ann;
       for (int i = ann.size(); --i >= 0; ) {
         if (Token.eq(ann.names[i].uri(), QueryText.UNITURI)) {
           fn.compile(ctx);
           break;
         }
       }
     }
   }
   return super.opt(ctx, scp);
 }
Exemplo n.º 2
0
  @Override
  public void compile(final QueryContext ctx) throws QueryException {
    if (compiled) return;
    compiled = true;

    if (check) {
      final StaticFunc sf = ctx.funcs.get(name, args.length, info);
      if (sf == null) throw Err.FUNCUNKNOWN.thrw(info, name.string());
      type = sf.funcType().seqType();
    }

    final int fp = scope.enter(ctx);
    try {
      expr = expr.compile(ctx, scope);
      expr.markTailCalls();
    } finally {
      scope.cleanUp(this);
      scope.exit(ctx, fp);
    }
  }
Exemplo n.º 3
0
 @Override
 protected Expr opt(final QueryContext qc, final VarScope scp) throws QueryException {
   for (final StaticFunc sf : qc.funcs.funcs()) sf.compile(qc);
   return this;
 }