/** * Registers and returns a new function call. * * @param ii input info * @param nm function name * @param id function id * @param arg arguments * @return new function call */ private UserFuncCall add(final InputInfo ii, final QNm nm, final int id, final Expr[] arg) { final UserFuncCall call = new BaseFuncCall(ii, nm, arg); // for dynamic calls if (funcs[id].declared) call.init(funcs[id]); calls[id] = Array.add(calls[id], call); return call; }
/** * Checks if all functions have been correctly declared, and initializes all function calls. * * @throws QueryException query exception */ public void check() throws QueryException { // initialize function calls for (int i = 0; i < funcs.length; ++i) { for (final UserFuncCall c : calls[i]) c.init(funcs[i]); } for (final UserFunc f : funcs) { if (f.expr == null) EXTERNALFUNC.thrw(f.info, f.name.string()); if (!f.declared) { // function has not been declared yet for (final UserFunc uf : funcs) { // check if another function with same name exists if (f != uf && f.name.eq(uf.name)) FUNCTYPE.thrw(f.info, uf.name.string()); } // if not, indicate that function is unknown FUNCUNKNOWN.thrw(f.info, f.name.string()); } } }