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

Fixed bug in message resolution of RList: Did return Java null which is not allowed.

parent 11b325b7
Branches
No related tags found
No related merge requests found
...@@ -41,6 +41,7 @@ import com.oracle.truffle.r.runtime.context.RContext; ...@@ -41,6 +41,7 @@ import com.oracle.truffle.r.runtime.context.RContext;
import com.oracle.truffle.r.runtime.context.RContext.RCloseable; import com.oracle.truffle.r.runtime.context.RContext.RCloseable;
import com.oracle.truffle.r.runtime.data.RFunction; import com.oracle.truffle.r.runtime.data.RFunction;
import com.oracle.truffle.r.runtime.data.RList; import com.oracle.truffle.r.runtime.data.RList;
import com.oracle.truffle.r.runtime.data.RNull;
import com.oracle.truffle.r.runtime.data.RStringVector; import com.oracle.truffle.r.runtime.data.RStringVector;
@MessageResolution(receiverType = RList.class, language = TruffleRLanguage.class) @MessageResolution(receiverType = RList.class, language = TruffleRLanguage.class)
...@@ -75,7 +76,8 @@ public class RListMR { ...@@ -75,7 +76,8 @@ public class RListMR {
@SuppressWarnings("try") @SuppressWarnings("try")
protected Object access(VirtualFrame frame, RList receiver, String field) { protected Object access(VirtualFrame frame, RList receiver, String field) {
try (RCloseable c = RContext.withinContext(TruffleRLanguage.INSTANCE.actuallyFindContext0(findContext))) { try (RCloseable c = RContext.withinContext(TruffleRLanguage.INSTANCE.actuallyFindContext0(findContext))) {
return extract.applyAccessField(frame, receiver, field); Object applyAccessField = extract.applyAccessField(frame, receiver, field);
return applyAccessField;
} }
} }
} }
...@@ -103,7 +105,8 @@ public class RListMR { ...@@ -103,7 +105,8 @@ public class RListMR {
@SuppressWarnings("try") @SuppressWarnings("try")
protected Object access(RList receiver) { protected Object access(RList receiver) {
try (RCloseable c = RContext.withinContext(TruffleRLanguage.INSTANCE.actuallyFindContext0(findContext))) { try (RCloseable c = RContext.withinContext(TruffleRLanguage.INSTANCE.actuallyFindContext0(findContext))) {
return getNamesNode.getNames(receiver); RStringVector names = getNamesNode.getNames(receiver);
return names != null ? names : RNull.instance;
} }
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment