Skip to content
Snippets Groups Projects
Commit f610487f authored by Florian Angerer's avatar Florian Angerer
Browse files

Fix: as.call could not handle language.

parent 92ddfaf1
No related branches found
No related tags found
No related merge requests found
......@@ -32,6 +32,7 @@ import com.oracle.truffle.api.profiles.ConditionProfile;
import com.oracle.truffle.r.nodes.RASTUtils;
import com.oracle.truffle.r.nodes.attributes.SpecialAttributesFunctions.GetNamesAttributeNode;
import com.oracle.truffle.r.nodes.builtin.RBuiltinNode;
import com.oracle.truffle.r.nodes.function.RCallBaseNode;
import com.oracle.truffle.r.runtime.ArgumentsSignature;
import com.oracle.truffle.r.runtime.RError;
import com.oracle.truffle.r.runtime.RError.Message;
......@@ -87,6 +88,15 @@ public abstract class AsCall extends RBuiltinNode.Arg1 {
}
}
protected boolean containsCall(RLanguage l) {
return l.getRep() instanceof RCallBaseNode;
}
@Specialization(guards = "containsCall(l)")
protected RLanguage asCall(RLanguage l) {
return l;
}
@Fallback
protected Object asCallFunction(@SuppressWarnings("unused") Object x) {
throw error(RError.Message.GENERIC, "invalid argument list");
......
......@@ -78,5 +78,7 @@ public class TestBuiltin_ascall extends TestBase {
assertEval(Output.IgnoreWhitespace, "as.call(list(as.symbol('function'), pairlist(a=1)))");
assertEval(Output.IgnoreWhitespace, "as.call(list(as.symbol('function')))");
assertEval(Output.IgnoreWhitespace, "call('function')");
assertEval(Output.IgnoreWhitespace, "{ cl <- quote(fun(3)); as.call(cl) }");
}
}
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