@Override public void visit(Symbol symbol) { if (context.hasVariable(symbol)) { result = unpromise(context.getVariable(symbol)); } else { result = symbol; } }
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(); }