Ejemplo n.º 1
0
  @Override
  public Expr compile(final QueryContext qc, final VarScope scp) throws QueryException {
    try {
      super.compile(qc, scp);
      if (expr.isValue()) return optPre(expr, qc);
    } catch (final QueryException ex) {
      if (!ex.isCatchable()) throw ex;
      for (final Catch c : catches) {
        if (c.matches(ex)) {
          // found a matching clause, compile and inline error message
          return optPre(c.compile(qc, scp).asExpr(ex, qc, scp), qc);
        }
      }
      throw ex;
    }

    for (final Catch c : catches) c.compile(qc, scp);
    return optimize(qc, scp);
  }