File tree Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -1407,20 +1407,25 @@ impl RMain {
14071407
14081408 // The global source reference is stored in this global variable by
14091409 // the R REPL before evaluation. We do the same here.
1410+ let old_srcref = libr:: Rf_protect ( libr:: get ( libr:: R_Srcref ) ) ;
14101411 libr:: set ( libr:: R_Srcref , srcref) ;
14111412
14121413 // Evaluate the expression. Beware: this may throw an R longjump.
14131414 let value = libr:: Rf_eval ( expr, frame) ;
14141415 libr:: Rf_protect ( value) ;
14151416
1417+ // Restore `R_Srcref`, necessary at least to avoid messing with
1418+ // DAP's last frame info
1419+ libr:: set ( libr:: R_Srcref , old_srcref) ;
1420+
14161421 // Store in the base environment for robust access from (almost) any
14171422 // evaluation environment. We only require the presence of `::` so
14181423 // we can reach into base. Note that unlike regular environments
14191424 // which are stored in pairlists or hash tables, the base environment
14201425 // is stored in the `value` field of symbols, i.e. their "CDR".
14211426 libr:: SETCDR ( r_symbol ! ( ".ark_last_value" ) , value) ;
14221427
1423- libr:: Rf_unprotect ( 2 ) ;
1428+ libr:: Rf_unprotect ( 3 ) ;
14241429 value
14251430 } ;
14261431
You can’t perform that action at this time.
0 commit comments