示例#1
0
 private Function evaluateFunction(SEXP functionExp, Environment rho) {
   if (functionExp instanceof Symbol) {
     Symbol symbol = (Symbol) functionExp;
     Function fn = rho.findFunction(this, symbol);
     if (fn == null) {
       throw new EvalException("could not find function '%s'", symbol.getPrintName());
     }
     return fn;
   } else {
     SEXP evaluated = evaluate(functionExp, rho).force(this);
     if (!(evaluated instanceof Function)) {
       throw new EvalException(
           "'function' of lang expression is of unsupported type '%s'", evaluated.getTypeName());
     }
     return (Function) evaluated;
   }
 }
示例#2
0
  private SEXP do_inherited_table(
      Context context, SEXP class_objs, SEXP fdef, SEXP mtable, Environment ev) {
    SEXP fun = methodsNamespace.findFunction(context, Symbol.get(".InheritForDispatch"));

    return context.evaluate(FunctionCall.newCall(fun, class_objs, fdef, mtable), ev);
  }