Skip to content

Commit

Permalink
Adjusting the code to not expect IOException from PolyglotEngine.eval…
Browse files Browse the repository at this point in the history
… and co.
  • Loading branch information
Jaroslav Tulach committed Jul 14, 2016
1 parent f1cec1e commit 09ab156
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,7 @@ static void readEvalPrint(ContextInfo info) {
*/
try {
vm.eval(subSource);
emitIO();
} catch (IncompleteSourceException | com.oracle.truffle.api.vm.IncompleteSourceException e) {
// read another line of input
consoleHandler.setPrompt(doEcho ? continuePrompt : null);
Expand Down Expand Up @@ -285,6 +286,7 @@ private static boolean doEcho(PolyglotEngine vm) {
PolyglotEngine.Value echoValue;
try {
echoValue = vm.eval(GET_ECHO);
emitIO();
Object echo = echoValue.get();
if (echo instanceof TruffleObject) {
RLogicalVector echoVec = echoValue.as(RLogicalVector.class);
Expand All @@ -302,4 +304,7 @@ private static boolean doEcho(PolyglotEngine vm) {
private static String getContinuePrompt() {
return RRuntime.asString(RRuntime.asAbstractVector(RContext.getInstance().stateROptions.getValue("continue")));
}

private static void emitIO() throws IOException {
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@
*/
package com.oracle.truffle.r.nodes.builtin.fastr;

import java.io.IOException;

import com.oracle.truffle.api.CallTarget;
import com.oracle.truffle.api.CompilerDirectives.TruffleBoundary;
import com.oracle.truffle.api.dsl.Specialization;
Expand Down Expand Up @@ -53,7 +51,9 @@ protected Object interopEval(Object mimeType, Object source) {

try {
callTarget = RContext.getInstance().getEnv().parse(sourceObject);
} catch (IOException e) {
} catch (RuntimeException e) {
throw e;
} catch (Exception e) {
throw new RuntimeException(e);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ public void run() {
PolyglotEngine vm = info.apply(PolyglotEngine.newBuilder()).build();
try {
setContext(vm.eval(GET_CONTEXT).as(RContext.class));
} catch (IOException e1) {
} catch (Exception e1) {
throw new RInternalError(e1, "error while initializing eval thread");
}
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@ private FastRSession() {
main = info.apply(PolyglotEngine.newBuilder()).build();
try {
mainContext = main.eval(GET_CONTEXT).as(RContext.class);
emitIO();
} catch (IOException e) {
throw new RuntimeException("error while retrieving test context", e);
}
Expand Down Expand Up @@ -248,6 +249,7 @@ public void run() {
try {
vm.eval(source);
input = consoleHandler.readLine();
emitIO();
} catch (IncompleteSourceException | com.oracle.truffle.api.vm.IncompleteSourceException e) {
String additionalInput = consoleHandler.readLine();
if (additionalInput == null) {
Expand Down Expand Up @@ -289,4 +291,7 @@ public void run() {
public String name() {
return "FastR";
}

static void emitIO() throws IOException {
}
}

0 comments on commit 09ab156

Please sign in to comment.