We want the call just prior to the call from Rcpp_eval This conditional matches tryCatch(evalq(sys.calls(), .GlobalEnv), error = identity, interrupt = identity)
| 256 | // This conditional matches |
| 257 | // tryCatch(evalq(sys.calls(), .GlobalEnv), error = identity, interrupt = identity) |
| 258 | inline bool is_Rcpp_eval_call(SEXP expr) { |
| 259 | SEXP sys_calls_symbol = Rf_install("sys.calls"); |
| 260 | SEXP identity_symbol = Rf_install("identity"); |
| 261 | Shield<SEXP> identity_fun(Rf_findFun(identity_symbol, R_BaseEnv)); |
| 262 | SEXP tryCatch_symbol = Rf_install("tryCatch"); |
| 263 | SEXP evalq_symbol = Rf_install("evalq"); |
| 264 | |
| 265 | return TYPEOF(expr) == LANGSXP && |
| 266 | Rf_length(expr) == 4 && |
| 267 | nth(expr, 0) == tryCatch_symbol && |
| 268 | CAR(nth(expr, 1)) == evalq_symbol && |
| 269 | CAR(nth(nth(expr, 1), 1)) == sys_calls_symbol && |
| 270 | nth(nth(expr, 1), 2) == R_GlobalEnv && |
| 271 | nth(expr, 2) == identity_fun && |
| 272 | nth(expr, 3) == identity_fun; |
| 273 | } |
| 274 | } // namespace internal |
| 275 | |
| 276 | } // namespace Rcpp |