Skip to content
Snippets Groups Projects
Commit 17984995 authored by Adam Welc's avatar Adam Welc
Browse files

Handle body of the function that is a single symbol.

parent 3a5bb2bd
No related branches found
No related tags found
No related merge requests found
......@@ -118,10 +118,15 @@ public abstract class AsFunction extends RBuiltinNode {
}
}
if (!(x.getDataAt(x.getLength() - 1) instanceof RLanguage)) {
RBaseNode body;
Object bodyObject = x.getDataAt(x.getLength() - 1);
if (bodyObject instanceof RLanguage) {
body = ((RLanguage) x.getDataAt(x.getLength() - 1)).getRep();
} else if (bodyObject instanceof RSymbol) {
body = ReadVariableNode.create(((RSymbol) bodyObject).getName());
} else {
throw RInternalError.unimplemented();
}
RBaseNode body = ((RLanguage) x.getDataAt(x.getLength() - 1)).getRep();
if (!RBaseNode.isRSyntaxNode(body)) {
throw RInternalError.unimplemented();
}
......
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