|
3 | 3 | // Environment.h: Rcpp R/C++ interface class library -- access R environments |
4 | 4 | // |
5 | 5 | // Copyright (C) 2009 - 2013 Dirk Eddelbuettel and Romain Francois |
6 | | -// Copyright (C) 2014 - 2019 Dirk Eddelbuettel, Romain Francois and Kevin Ushey |
| 6 | +// Copyright (C) 2014 - 2020 Dirk Eddelbuettel, Romain Francois and Kevin Ushey |
7 | 7 | // |
8 | 8 | // This file is part of Rcpp. |
9 | 9 | // |
@@ -33,8 +33,8 @@ namespace Rcpp{ |
33 | 33 | if( Rf_isEnvironment(x) ) return x ; |
34 | 34 | SEXP asEnvironmentSym = Rf_install("as.environment"); |
35 | 35 | try { |
36 | | - Shield<SEXP> res(Rcpp_fast_eval(Rf_lang2(asEnvironmentSym, x), R_GlobalEnv)); |
37 | | - return res ; |
| 36 | + Shield<SEXP> call(Rf_lang2(asEnvironmentSym, x)); |
| 37 | + return Rcpp_fast_eval(call, R_GlobalEnv); |
38 | 38 | } catch( const eval_error& ex) { |
39 | 39 | const char* fmt = "Cannot convert object to an environment: " |
40 | 40 | "[type=%s; target=ENVSXP]."; |
@@ -393,10 +393,10 @@ namespace Rcpp{ |
393 | 393 | */ |
394 | 394 | Environment_Impl new_child(bool hashed) const { |
395 | 395 | SEXP newEnvSym = Rf_install("new.env"); |
396 | | - return Environment_Impl(Rcpp_fast_eval(Rf_lang3(newEnvSym, Rf_ScalarLogical(hashed), Storage::get__()), R_GlobalEnv)); |
| 396 | + Shield<SEXP> call(Rf_lang3(newEnvSym, Rf_ScalarLogical(hashed), Storage::get__())); |
| 397 | + return Environment_Impl(Rcpp_fast_eval(call, R_GlobalEnv)); |
397 | 398 | } |
398 | 399 |
|
399 | | - |
400 | 400 | void update(SEXP){} |
401 | 401 | }; |
402 | 402 |
|
|
0 commit comments