@@ -97,6 +97,9 @@ pub fn resolve_import_stmt(session: &mut SessionInfo, source_file_symbol: &Rc<Re
97
97
let mut name_index: i32 = -1 ;
98
98
for alias in name_aliases. iter ( ) {
99
99
let name = oyarn ! ( "{}" , alias. name) ;
100
+ if name == "odoo.init" {
101
+ println ! ( "here" ) ;
102
+ }
100
103
name_index += 1 ;
101
104
if let Some ( hook_result) = resolve_import_stmt_hook ( alias, & from_symbol, session, source_file_symbol, from_stmt, level, diagnostics) {
102
105
result[ name_index as usize ] = hook_result;
@@ -135,6 +138,19 @@ pub fn resolve_import_stmt(session: &mut SessionInfo, source_file_symbol: &Rc<Re
135
138
result[ name_index as usize ] . name = name. split ( "." ) . map ( |s| oyarn ! ( "{}" , s) ) . next ( ) . unwrap ( ) ;
136
139
result[ name_index as usize ] . found = true ;
137
140
result[ name_index as usize ] . symbol = name_symbol. as_ref ( ) . unwrap ( ) . clone ( ) ;
141
+ //we found name_symbol and will return it. But in the case of "import A.B.C", even if we will return A, we need to effectively import B then
142
+ //C as it can have effects on the codebase
143
+ let name_split: Vec < OYarn > = name. split ( "." ) . map ( |s| oyarn ! ( "{}" , s) ) . collect ( ) ;
144
+ if name_split. len ( ) > 1 {
145
+ _get_or_create_symbol (
146
+ session,
147
+ & entry,
148
+ source_path. as_str ( ) ,
149
+ Some ( name_symbol. as_ref ( ) . unwrap ( ) . clone ( ) ) ,
150
+ & Vec :: from_iter ( name_split[ 1 ..name_split. len ( ) ] . iter ( ) . cloned ( ) ) ,
151
+ None ,
152
+ None ) ;
153
+ }
138
154
continue ;
139
155
}
140
156
let name_split: Vec < OYarn > = name. split ( "." ) . map ( |s| oyarn ! ( "{}" , s) ) . collect ( ) ;
@@ -367,6 +383,9 @@ fn _resolve_new_symbol(session: &mut SessionInfo, parent: Rc<RefCell<Symbol>>, n
367
383
let _arc_symbol = Symbol :: create_from_path ( session, & full_path. with_extension ( "py" ) , parent. clone ( ) , false ) ;
368
384
if _arc_symbol. is_some ( ) {
369
385
let _arc_symbol = _arc_symbol. unwrap ( ) ;
386
+ if full_path. ends_with ( "init.py" ) {
387
+ println ! ( "here" ) ;
388
+ }
370
389
SyncOdoo :: rebuild_arch_now ( session, & _arc_symbol) ;
371
390
return Ok ( _arc_symbol) ;
372
391
}
0 commit comments