private PairList unpackPromiseList(PromisePairList dotExp) {
   PairList.Builder unpacked = new PairList.Node.Builder();
   for (PairList.Node node : dotExp.nodes()) {
     unpacked.add(node.getRawTag(), unpromise(node.getValue()));
   }
   return unpacked.build();
 }
 @Override
 public void visit(PairList.Node pairList) {
   PairList.Builder builder = PairList.Node.newBuilder();
   for (PairList.Node node : pairList.nodes()) {
     builder.add(node.getRawTag(), substitute(node.getValue()));
   }
   result = builder.build();
 }
 private PairList substituteArgumentList(PairList arguments) {
   PairList.Builder builder = PairList.Node.newBuilder();
   for (PairList.Node node : arguments.nodes()) {
     if (node.getValue().equals(Symbols.ELLIPSES)) {
       SEXP extraArguments = context.getVariable(Symbols.ELLIPSES);
       if (extraArguments != Symbol.UNBOUND_VALUE) {
         builder.addAll(unpackPromiseList((PromisePairList) extraArguments));
       } else {
         builder.add(Symbols.ELLIPSES);
       }
     } else {
       builder.add(node.getRawTag(), substitute(node.getValue()));
     }
   }
   return builder.build();
 }
示例#4
0
  private SEXP R_S_MethodsListSelect(Context context, SEXP fname, SEXP ev, SEXP mlist, SEXP f_env) {
    PairList.Builder args = new PairList.Builder();
    args.add(fname);
    args.add(ev);
    args.add(mlist);
    if (f_env != Null.INSTANCE) {
      args.add(f_env);
    }

    try {
      return context.evaluate(
          new FunctionCall(s_MethodsListSelect, args.build()), methodsNamespace);
    } catch (EvalException e) {
      throw new EvalException(
          String.format(
              "S language method selection got an error when called from"
                  + " internal dispatch for function '%s'",
              fname),
          e);
    }
  }