diff --git a/com.oracle.truffle.r.launcher/src/com/oracle/truffle/r/launcher/RCommand.java b/com.oracle.truffle.r.launcher/src/com/oracle/truffle/r/launcher/RCommand.java index 11e4450e7b3e8194b1ffbd3d0d007b3f5452b43e..0901e341ed7968d6bd23a261cc6ee89e9fa31920 100644 --- a/com.oracle.truffle.r.launcher/src/com/oracle/truffle/r/launcher/RCommand.java +++ b/com.oracle.truffle.r.launcher/src/com/oracle/truffle/r/launcher/RCommand.java @@ -213,10 +213,10 @@ public class RCommand { return input.replace("~+~", " "); } - private static final String GET_ECHO = "invisible(getOption('echo'))"; - private static final String QUIT_EOF = "quit(\"default\", 0L, TRUE)"; - private static final String GET_PROMPT = "invisible(getOption('prompt'))"; - private static final String GET_CONTINUE_PROMPT = "invisible(getOption('continue'))"; + private static final Source GET_ECHO = Source.newBuilder("R", ".Internal(getOption('echo'))", "<echo>").internal(true).buildLiteral(); + private static final Source QUIT_EOF = Source.newBuilder("R", ".Internal(quit('default', 0L, TRUE))", "<quit-on-eof>").internal(true).buildLiteral(); + private static final Source GET_PROMPT = Source.newBuilder("R", ".Internal(getOption('prompt'))", "<prompt>").internal(true).buildLiteral(); + private static final Source GET_CONTINUE_PROMPT = Source.newBuilder("R", ".Internal(getOption('continue'))", "<continue-prompt>").internal(true).buildLiteral(); /** * The read-eval-print loop, which can take input from a console, command line expression or a @@ -285,7 +285,7 @@ public class RCommand { } } catch (EOFException e) { try { - context.eval("R", QUIT_EOF); + context.eval(QUIT_EOF); } catch (PolyglotException e2) { if (e2.isExit()) { return e2.getExitStatus(); @@ -309,7 +309,7 @@ public class RCommand { private static boolean doEcho(Context context) { try { - return context.eval("R", GET_ECHO).asBoolean(); + return context.eval(GET_ECHO).asBoolean(); } catch (PolyglotException e) { if (e.isExit()) { throw new ExitException(e.getExitStatus()); @@ -320,7 +320,7 @@ public class RCommand { private static String getPrompt(Context context) { try { - return context.eval("R", GET_PROMPT).asString(); + return context.eval(GET_PROMPT).asString(); } catch (PolyglotException e) { if (e.isExit()) { throw new ExitException(e.getExitStatus()); @@ -331,7 +331,7 @@ public class RCommand { private static String getContinuePrompt(Context context) { try { - return context.eval("R", GET_CONTINUE_PROMPT).asString(); + return context.eval(GET_CONTINUE_PROMPT).asString(); } catch (PolyglotException e) { if (e.isExit()) { throw new ExitException(e.getExitStatus()); diff --git a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/attributes/SpecialAttributesFunctions.java b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/attributes/SpecialAttributesFunctions.java index 77cb4bb1ea1f8c668f5ecac08ac2b68d7e22d7cc..9a3ada865ce54def12b11b86acf8f475580fe95b 100644 --- a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/attributes/SpecialAttributesFunctions.java +++ b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/attributes/SpecialAttributesFunctions.java @@ -764,7 +764,7 @@ public final class SpecialAttributesFunctions { for (int i = 0; loopProfile.inject(i < newDimNamesLength); i++) { Object dimObject = newDimNames.getDataAt(i); - if (dimObject == RNull.instance || (dimObject instanceof RStringVector && ((RStringVector) dimObject).getLength() == 0)) { + if (dimObject instanceof RStringVector && ((RStringVector) dimObject).getLength() == 0) { nullDimProfile.enter(); newDimNames.updateDataAt(i, RNull.instance, null); } else if ((dimObject instanceof String && dimensions[i] != 1) ||