Esempio n. 1
0
 @Override
 public Expr copy(final QueryContext ctx, final VarScope o, final IntObjMap<Var> vs) {
   final VarScope scp = new VarScope();
   final Var[] arg = new Var[args.length];
   for (int i = 0; i < arg.length; i++) vs.put(args[i].id, arg[i] = scp.newCopyOf(ctx, args[i]));
   final Expr call = expr.copy(ctx, scp, vs);
   return new FuncLit(name, arg, call, (FuncType) type.type, scp, sc, info);
 }
Esempio n. 2
0
 @Override
 public Expr copy(final QueryContext qc, final VarScope scp, final IntObjMap<Var> vs) {
   final Var v = scp.addCopy(var, qc);
   vs.put(var.id, v);
   final Spec spec = new Spec(info, v, expr.copy(qc, scp, vs), coll);
   spec.occluded = occluded;
   return spec;
 }
Esempio n. 3
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);
    }
  }
Esempio n. 4
0
  @Override
  public GroupBy copy(final QueryContext qc, final VarScope scp, final IntObjMap<Var> vs) {
    // copy the pre-grouping expressions
    final Expr[] pEx = Arr.copyAll(qc, scp, vs, preExpr);

    // create fresh copies of the post-grouping variables
    final Var[] ps = new Var[post.length];
    final int pl = ps.length;
    for (int p = 0; p < pl; p++) {
      final Var old = post[p];
      ps[p] = scp.addCopy(old, qc);
      vs.put(old.id, ps[p]);
    }

    // done
    return new GroupBy(Arr.copyAll(qc, scp, vs, specs), pEx, ps, nonOcc, info);
  }
Esempio n. 5
0
 @Override
 public Count copy(final QueryContext qc, final VarScope scp, final IntObjMap<Var> vs) {
   final Var v = scp.newCopyOf(qc, var);
   vs.put(var.id, v);
   return new Count(v, info);
 }