示例#1
0
 @Override
 public Expr optimize(final QueryContext ctx, final VarScope scp) throws QueryException {
   final SeqType s0 = expr[0].type();
   final SeqType s1 = expr[1].type();
   final Type t0 = s0.type;
   final Type t1 = s1.type;
   if (t0.isNumberOrUntyped() && t1.isNumberOrUntyped()) {
     final Occ occ = s0.one() && s1.one() ? Occ.ONE : Occ.ZERO_ONE;
     type = SeqType.get(Calc.type(t0, t1), occ);
   } else if (s0.one() && s1.one()) {
     type = SeqType.ITEM;
   }
   return optPre(oneIsEmpty() ? null : allAreValues() ? item(ctx, info) : this, ctx);
 }