@@ -5,14 +5,17 @@ use std::{
5
5
} ;
6
6
7
7
use pyo3:: { pyclass, pymethods} ;
8
- use rustpython_ast:: { Expr , ExprCompare , Stmt , StmtImport , StmtImportFrom , Suite , Visitor } ;
8
+ use rustpython_ast:: {
9
+ Arg , Arguments , Expr , ExprCompare , Stmt , StmtImport , StmtImportFrom , Suite , Visitor ,
10
+ } ;
9
11
use rustpython_parser:: Parse ;
10
12
11
13
use crate :: common:: {
12
14
ast:: {
13
15
full_name:: { get_full_name_for_expr, get_full_name_for_stmt} ,
14
16
get_import_from_absolute_module_spec,
15
17
providers:: fully_qualified_name_provider:: FullyQualifiedNameProvider ,
18
+ visitor_patch:: VisitorPatch ,
16
19
} ,
17
20
module_spec:: get_parent_package,
18
21
} ;
@@ -372,6 +375,13 @@ impl Visitor for ReferencesCounter {
372
375
373
376
match expr {
374
377
Expr :: Call ( _) => {
378
+ if let Some ( full_name) = get_full_name_for_expr ( & expr) {
379
+ println ! (
380
+ "Default {} {}" ,
381
+ full_name,
382
+ self . is_global_scope( ) && self . module_spec_has_references( )
383
+ )
384
+ }
375
385
if self . is_global_scope ( ) && self . module_spec_has_references ( ) {
376
386
self . maybe_increase_expr ( & expr) ;
377
387
self . always_bump_context = true ;
@@ -395,4 +405,14 @@ impl Visitor for ReferencesCounter {
395
405
self . names_provider . visit_import_from ( & node) ;
396
406
self . generic_visit_stmt_import_from ( node) ;
397
407
}
408
+
409
+ fn generic_visit_arg ( & mut self , node : Arg ) {
410
+ self . generic_visit_arg_patch ( node) ;
411
+ }
412
+
413
+ fn generic_visit_arguments ( & mut self , node : Arguments ) {
414
+ self . generic_visit_arguments_patch ( node) ;
415
+ }
398
416
}
417
+
418
+ impl VisitorPatch for ReferencesCounter { }
0 commit comments