From 8f95a7076862e238463e4ee57618d7600474bbba Mon Sep 17 00:00:00 2001
From: Zbynek Slajchrt <zbynek.slajchrt@oracle.com>
Date: Tue, 24 Oct 2017 09:43:39 +0200
Subject: [PATCH] Enabling shiny/httpuv

---
 .../fficall/src/common/Rinternals_common.c                 | 2 ++
 .../fficall/src/common/unimplemented.c                     | 7 +++++++
 .../oracle/truffle/r/nodes/builtin/base/AsFunction.java    | 2 +-
 3 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/com.oracle.truffle.r.native/fficall/src/common/Rinternals_common.c b/com.oracle.truffle.r.native/fficall/src/common/Rinternals_common.c
index b4c88dff80..db517f214d 100644
--- a/com.oracle.truffle.r.native/fficall/src/common/Rinternals_common.c
+++ b/com.oracle.truffle.r.native/fficall/src/common/Rinternals_common.c
@@ -111,6 +111,8 @@ void *DATAPTR(SEXP x) {
 		return REAL(x);
 	} else if (type == LGLSXP) {
 		return LOGICAL(x);
+	} else if (type == RAWSXP) {
+		return RAW(x);
 	} else {
 		printf("DATAPTR %d\n", type);
 		unimplemented("R_DATAPTR");
diff --git a/com.oracle.truffle.r.native/fficall/src/common/unimplemented.c b/com.oracle.truffle.r.native/fficall/src/common/unimplemented.c
index 4dbe601ee0..718838dbdd 100644
--- a/com.oracle.truffle.r.native/fficall/src/common/unimplemented.c
+++ b/com.oracle.truffle.r.native/fficall/src/common/unimplemented.c
@@ -75,6 +75,13 @@ addInputHandler(InputHandler *handlers, int fd, InputHandlerProc handler,
     return NULL;
 }
 
+int
+removeInputHandler(InputHandler **handlers, InputHandler *it)
+{
+    unimplemented("removeInputHandler");
+    return NULL;
+}
+
 void setup_RdotApp(void) {
 	unimplemented("setup_RdotApp");
 }
diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/AsFunction.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/AsFunction.java
index 6f9d7397c1..f996bc6bb4 100644
--- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/AsFunction.java
+++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/AsFunction.java
@@ -129,7 +129,7 @@ public abstract class AsFunction extends RBuiltinNode.Arg2 {
         RBaseNode body;
         Object bodyObject = x.getDataAtAsObject(x.getLength() - 1);
         if (bodyObject instanceof RLanguage) {
-            body = ((RLanguage) x.getDataAtAsObject(x.getLength() - 1)).getRep();
+            body = (RBaseNode) RContext.getASTBuilder().process(((RLanguage) x.getDataAtAsObject(x.getLength() - 1)).getRep().asRSyntaxNode());
         } else if (bodyObject instanceof RSymbol) {
             body = RContext.getASTBuilder().lookup(RSyntaxNode.LAZY_DEPARSE, ((RSymbol) bodyObject).getName(), false).asRNode();
         } else {
-- 
GitLab