@@ -25,31 +25,17 @@ namespace Rcpp {
25
25
inline SEXP Rcpp_eval (SEXP expr, SEXP env) {
26
26
27
27
// 'identity' function used to capture errors, interrupts
28
- SEXP identity = Rf_findFun (
29
- ::Rf_install (" identity" ),
30
- R_BaseNamespace
31
- );
28
+ SEXP identity = Rf_findFun (::Rf_install (" identity" ), R_BaseNamespace);
32
29
33
30
if (identity == R_UnboundValue) {
34
31
stop (" Failed to find 'base::identity()'" );
35
32
}
36
33
37
- // define the evalq call -- the actual R evaluation we
38
- // want to execute
39
- Shield<SEXP> evalqCall (Rf_lang3 (
40
- ::Rf_install (" evalq" ),
41
- expr,
42
- env
43
- ));
34
+ // define the evalq call -- the actual R evaluation we want to execute
35
+ Shield<SEXP> evalqCall (Rf_lang3 (::Rf_install (" evalq" ), expr, env));
44
36
45
- // define the call -- enclose with `tryCatch` so we can record
46
- // and later forward error messages
47
- Shield<SEXP> call (Rf_lang4 (
48
- ::Rf_install (" tryCatch" ),
49
- evalqCall,
50
- identity,
51
- identity
52
- ));
37
+ // define the call -- enclose with `tryCatch` so we can record and forward error messages
38
+ Shield<SEXP> call (Rf_lang4 (::Rf_install (" tryCatch" ), evalqCall, identity, identity));
53
39
SET_TAG (CDDR (call), ::Rf_install (" error" ));
54
40
SET_TAG (CDDR (CDR (call)), ::Rf_install (" interrupt" ));
55
41
@@ -61,10 +47,7 @@ inline SEXP Rcpp_eval(SEXP expr, SEXP env) {
61
47
62
48
if (Rf_inherits (res, " error" )) {
63
49
64
- Shield<SEXP> conditionMessageCall (::Rf_lang2 (
65
- ::Rf_install (" conditionMessage" ),
66
- res
67
- ));
50
+ Shield<SEXP> conditionMessageCall (::Rf_lang2 (::Rf_install (" conditionMessage" ), res));
68
51
69
52
Shield<SEXP> conditionMessage (::Rf_eval (conditionMessageCall, R_GlobalEnv));
70
53
throw eval_error (CHAR (STRING_ELT (conditionMessage, 0 )));
0 commit comments