From cc42bfe8c3d5947b34c3d497260d8411b1f4442b Mon Sep 17 00:00:00 2001 From: Christophe Rhodes Date: Tue, 20 Nov 2012 22:36:39 +0000 Subject: [PATCH] fix compilation of x[y,] Oh boy. I do not pretend to totally understand what is going on, but what seemed to be happening is that somehow when walking the parse tree to adjust srcrefs to the real file position rather than the string position, the `empty' space in x[y,] was turning from a zero-element name to a missing object, and then subsequent attempts to evaluate the missing object (or even return it) were failing. The workaround is to short-circuit the process for name objects, which are atomic and (empirically) do not have srcrefs attached anyway and so can be returned without modification. --- swank.R | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/swank.R b/swank.R index 99012ec..757e243 100644 --- a/swank.R +++ b/swank.R @@ -514,6 +514,17 @@ computeRestartsForEmacs <- function (sldbState) { ifelse(x[3]==1, x[6]+colOffset-1, x[6])))) } transformSrcrefs <- function(s) { + ## horrendous KLUDGE: we need to short-circuit here for "name" + ## objects, rather than having a nice uniform behaviour, because + ## for expressions of the form x[y,] there is an empty "name" + ## which ends up becoming a `missing' object when passed through + ## the switch; why, I do not know, but it is then impossible to + ## return it, because returning it attempts to evaluate it and + ## evaluating it is an error. Fortunately it appears that names + ## don't have srcrefs attached. + if(mode(s) == "name") { + return(s) + } srcrefs <- attr(s, "srcref") attribs <- attributes(s) new <- -- 2.30.2