示例#1
0
 /**
  * Creates a function literal for a function that was not yet encountered while parsing.
  *
  * @param nm function name
  * @param ar function arity
  * @param ctx query context
  * @param ii input info
  * @return function literal
  * @throws QueryException query exception
  */
 public static FuncLit unknown(
     final QNm nm, final long ar, final QueryContext ctx, final InputInfo ii)
     throws QueryException {
   final VarScope scp = new VarScope();
   final FuncType temp = FuncType.arity((int) ar);
   final Var[] arg = new Var[(int) ar];
   final Expr[] refs = temp.args(arg, ctx, scp, ii);
   final TypedFunc call = ctx.funcs.getFuncRef(nm, refs, ctx.sc, ii);
   return new FuncLit(nm, arg, call.fun, null, scp, ctx.sc, ii);
 }
示例#2
0
 /**
  * Constructor.
  *
  * @param nm function name
  * @param arg formal parameters
  * @param fn function body
  * @param ft function type
  * @param scp variable scope
  * @param sctx static context
  * @param ii input info
  */
 public FuncLit(
     final QNm nm,
     final Var[] arg,
     final Expr fn,
     final FuncType ft,
     final VarScope scp,
     final StaticContext sctx,
     final InputInfo ii) {
   super(ii, fn);
   name = nm;
   args = arg;
   check = ft == null;
   type = (ft == null ? FuncType.arity(args.length) : ft).seqType();
   scope = scp;
   sc = sctx;
 }