Skip to content
Snippets Groups Projects
Commit 82a19107 authored by stepan's avatar stepan
Browse files

RfEvalNode can handle RSymbol in pairlist (looks up the function)

parent 9e1bd388
No related branches found
No related tags found
No related merge requests found
...@@ -99,20 +99,24 @@ public abstract class RfEvalNode extends FFIUpCallNode.Arg2 { ...@@ -99,20 +99,24 @@ public abstract class RfEvalNode extends FFIUpCallNode.Arg2 {
Object handlePairList(RPairList l, Object envArg, Object handlePairList(RPairList l, Object envArg,
@Cached("createBinaryProfile()") ConditionProfile isPromiseProfile, @Cached("createBinaryProfile()") ConditionProfile isPromiseProfile,
@Cached("createBinaryProfile()") ConditionProfile noArgsProfile) { @Cached("createBinaryProfile()") ConditionProfile noArgsProfile) {
REnvironment env = getEnv(envArg);
Object car = l.car(); Object car = l.car();
RFunction f; RFunction f = null;
if (isPromiseProfile.profile(car instanceof RPromise)) { if (isPromiseProfile.profile(car instanceof RPromise)) {
car = getPromiseHelper().evaluate(null, (RPromise) car); car = getPromiseHelper().evaluate(null, (RPromise) car);
} }
if (car instanceof RFunction) { if (car instanceof RFunction) {
f = (RFunction) car; f = (RFunction) car;
} else { } else if (car instanceof RSymbol) {
f = ReadVariableNode.lookupFunction(((RSymbol) car).getName(), env.getFrame());
}
if (f == null) {
throw RError.error(RError.NO_CALLER, ARGUMENT_NOT_FUNCTION); throw RError.error(RError.NO_CALLER, ARGUMENT_NOT_FUNCTION);
} }
Object args = l.cdr(); Object args = l.cdr();
REnvironment env = getEnv(envArg);
if (noArgsProfile.profile(args == RNull.instance)) { if (noArgsProfile.profile(args == RNull.instance)) {
return evalFunction(f, env, null); return evalFunction(f, env, null);
} else { } else {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment