Exemplo n.º 1
0
  @Override
  public Value value(final QueryContext ctx) throws QueryException {

    Expr fun = func;
    Var[] args = args(ctx);
    do {
      // cache arguments, evaluate function and reset variable scope
      final VarStack cs = addArgs(ctx, args);
      ctx.tailCalls = 0;
      try {
        return fun.value(ctx);
      } catch (final Continuation c) {
        fun = c.getFunc();
        args = c.getArgs();
      } finally {
        ctx.vars.reset(cs);
      }
    } while (true);
  }