File tree Expand file tree Collapse file tree 2 files changed +10
-13
lines changed Expand file tree Collapse file tree 2 files changed +10
-13
lines changed Original file line number Diff line number Diff line change @@ -118,7 +118,7 @@ use crate::signals::initialize_signal_handlers;
118
118
use crate :: signals:: interrupts_pending;
119
119
use crate :: signals:: set_interrupts_pending;
120
120
use crate :: srcref:: ns_populate_srcref;
121
- use crate :: srcref:: resource_namespaces ;
121
+ use crate :: srcref:: resource_loaded_namespaces ;
122
122
use crate :: startup;
123
123
use crate :: strings:: lines;
124
124
use crate :: sys:: console:: console_to_utf8;
@@ -452,7 +452,7 @@ impl RMain {
452
452
// Namespaces of future loaded packages will be populated on load.
453
453
// (after r_task initialization)
454
454
if do_resource_namespaces ( ) {
455
- if let Err ( err) = resource_namespaces ( None ) {
455
+ if let Err ( err) = resource_loaded_namespaces ( ) {
456
456
log:: error!( "Can't populate srcrefs for loaded packages: {err:?}" ) ;
457
457
}
458
458
}
Original file line number Diff line number Diff line change @@ -16,16 +16,7 @@ use crate::variables::variable::is_binding_fancy;
16
16
use crate :: variables:: variable:: plain_binding_force_with_rollback;
17
17
18
18
#[ tracing:: instrument( level = "trace" , skip_all) ]
19
- pub ( crate ) fn resource_namespaces ( pkgs : Option < Vec < String > > ) -> anyhow:: Result < ( ) > {
20
- let pkgs = match pkgs {
21
- Some ( inner) => inner,
22
- None => {
23
- let loaded = RFunction :: new ( "base" , "loadedNamespaces" ) . call ( ) ?;
24
- let loaded: Vec < String > = loaded. try_into ( ) ?;
25
- loaded
26
- } ,
27
- } ;
28
-
19
+ pub ( crate ) fn resource_namespaces ( pkgs : Vec < String > ) -> anyhow:: Result < ( ) > {
29
20
// Generate only one task and loop inside it to preserve the order of `pkgs`
30
21
r_task:: spawn_idle ( || async move {
31
22
for pkg in pkgs. into_iter ( ) {
@@ -38,10 +29,16 @@ pub(crate) fn resource_namespaces(pkgs: Option<Vec<String>>) -> anyhow::Result<(
38
29
Ok ( ( ) )
39
30
}
40
31
32
+ pub ( crate ) fn resource_loaded_namespaces ( ) -> anyhow:: Result < ( ) > {
33
+ let loaded = RFunction :: new ( "base" , "loadedNamespaces" ) . call ( ) ?;
34
+ let loaded: Vec < String > = loaded. try_into ( ) ?;
35
+ resource_namespaces ( loaded)
36
+ }
37
+
41
38
#[ harp:: register]
42
39
unsafe extern "C" fn ps_resource_namespaces ( pkgs : SEXP ) -> anyhow:: Result < SEXP > {
43
40
let pkgs: Vec < String > = RObject :: view ( pkgs) . try_into ( ) ?;
44
- resource_namespaces ( Some ( pkgs) ) ?;
41
+ resource_namespaces ( pkgs) ?;
45
42
Ok ( harp:: r_null ( ) )
46
43
}
47
44
You can’t perform that action at this time.
0 commit comments