[Rcpp-commits] r3552 - pkg/Rcpp/R

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Sat Mar 24 18:14:52 CET 2012


Author: romain
Date: 2012-03-24 18:14:51 +0100 (Sat, 24 Mar 2012)
New Revision: 3552

Modified:
   pkg/Rcpp/R/tools.R
Log:
 getting rid of the unlockbinding note

Modified: pkg/Rcpp/R/tools.R
===================================================================
--- pkg/Rcpp/R/tools.R	2012-03-24 16:43:52 UTC (rev 3551)
+++ pkg/Rcpp/R/tools.R	2012-03-24 17:14:51 UTC (rev 3552)
@@ -21,16 +21,13 @@
 
 # just like assignInNamespace but first checks that the binding exists
 forceAssignInNamespace <- function( x, value, env ){
-    #if (getRversion() >= "2.15.0") {
-    #    assignInMyNamespace(x, value)
-    #} else {
-        is_ns <- isNamespace( env )
-        if( is_ns && exists( x, env ) && bindingIsLocked(x, env ) ){
-            unlockBinding( x, env )
-        }
-        assign( x, value, env )
-        if( is_ns ){
-            lockBinding( x, env )
-        }
-    #}
+    is_ns <- isNamespace( env )
+    unlocker <- get( "unlockBinding", baseenv() )
+    if( is_ns && exists( x, env ) && bindingIsLocked(x, env ) ){
+        unlocker( x, env )
+    }
+    assign( x, value, env )
+    if( is_ns ){
+        lockBinding( x, env )
+    }
 }



More information about the Rcpp-commits mailing list