From 76205238abe6fb4cea1d9e8a4917319dc29ea64b Mon Sep 17 00:00:00 2001
From: Florian Angerer <florian.angerer@oracle.com>
Date: Fri, 11 Aug 2017 11:57:25 +0200
Subject: [PATCH] Fix: using original signature for dummy functions.

---
 .../library/fastrGrid/graphics/R/fastrGraphics.R  | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/fastrGrid/graphics/R/fastrGraphics.R b/com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/fastrGrid/graphics/R/fastrGraphics.R
index 7a48a7b74f..2ffbef80c8 100644
--- a/com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/fastrGrid/graphics/R/fastrGraphics.R
+++ b/com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/fastrGrid/graphics/R/fastrGraphics.R
@@ -26,10 +26,23 @@
 
 eval(expression({
     graphicsWarning <- function(name) {
-        function(...) {
+    	# lookup original function and fetch signature
+    	fun <- tryCatch(get(name, environment()), error=function(x) NULL)
+    	if(!is.null(fun)) {
+    	    sig <- formals(fun)
+    	} else {
+    	    sig <- NULL
+    	}
+    	
+        replacementFun <- function(...) {
             warning(paste0(name, " not supported.", " Note: FastR does not support graphics package and most of its functions. Please use grid package or grid based packages like lattice instead."))
             NULL
         }
+
+		if(!is.null(sig)) {
+        	formals(replacementFun) <- sig
+        }
+        return(replacementFun)
     }
 
     plot.default <- function (x, y = NULL, type = "p", xlim = NULL, ylim = NULL,
-- 
GitLab