Exemple #1
0
 @Override
 public Iter iter(final QueryContext qc) throws QueryException {
   final Value seq = qc.value(ts);
   for (final TypeCase tc : cases) {
     final Iter iter = tc.iter(qc, seq);
     if (iter != null) return iter;
   }
   // will never happen
   throw Util.notExpected();
 }
Exemple #2
0
  @Override
  public Expr compile(final QueryContext qc, final VarScope scp) throws QueryException {
    ts = ts.compile(qc, scp);
    // static condition: return branch in question
    if (ts.isValue()) {
      final Value val = ts.value(qc);
      for (final TypeCase tc : cases) {
        if (tc.matches(val)) return optPre(tc.compile(qc, scp, (Value) ts).expr, qc);
      }
    }
    // compile branches
    for (final TypeCase tc : cases) tc.compile(qc, scp);

    return optimize(qc, scp);
  }
Exemple #3
0
 @Override
 public boolean has(final Flag flag) {
   for (final TypeCase tc : cases) if (tc.has(flag)) return true;
   return ts.has(flag);
 }
Exemple #4
0
 @Override
 public void markTailCalls(final QueryContext qc) {
   for (final TypeCase t : cases) t.markTailCalls(qc);
 }
Exemple #5
0
 @Override
 public boolean removable(final Var var) {
   for (final TypeCase tc : cases) if (!tc.removable(var)) return false;
   return ts.removable(var);
 }