@@ -216,34 +216,40 @@ def get_inner_scope(self, line_number: int):
216
216
return curr_scope
217
217
218
218
def get_object (self , FQSN : str ):
219
- FQSN_split = FQSN .split ("::" )
220
- curr_obj = self .global_dict .get (FQSN_split [0 ])
221
- if curr_obj is None :
222
- # Look for non-exportable scopes
223
- for scope in self .scope_list :
224
- if FQSN_split [0 ] == scope .FQSN :
225
- curr_obj = scope
226
- break
227
- if curr_obj is None :
219
+ def find_child_by_name (parent , name ):
220
+ for child in parent .children :
221
+ if child .name == name :
222
+ return child
223
+ if child .name .startswith ("#GEN_INT" ):
224
+ found = next (
225
+ (
226
+ int_child
227
+ for int_child in child .get_children ()
228
+ if int_child .name == name
229
+ ),
230
+ None ,
231
+ )
232
+ if found :
233
+ return found
228
234
return None
229
- if len ( FQSN_split ) > 1 :
230
- for name in FQSN_split [ 1 :]:
231
- next_obj = None
232
- for child in curr_obj . children :
233
- if child . name . startswith ( "#GEN_INT" ):
234
- for int_child in child . get_children () :
235
- if int_child . name == name :
236
- next_obj = int_child
237
- break
238
- if next_obj is not None :
239
- break
240
- if child . name == name :
241
- next_obj = child
242
- break
243
- if next_obj is None :
244
- return None
245
- curr_obj = next_obj
246
- return curr_obj
235
+
236
+ parts = FQSN . split ( "::" )
237
+ current = self . global_dict . get ( parts [ 0 ])
238
+
239
+ # Look for non-exportable scopes
240
+ if current is None :
241
+ current = next (
242
+ ( scope for scope in self . scope_list if scope . FQSN == parts [ 0 ]), None
243
+ )
244
+ if current is None :
245
+ return None
246
+
247
+ for part in parts [ 1 :]:
248
+ current = find_child_by_name ( current , part )
249
+ if current is None :
250
+ return None
251
+
252
+ return current
247
253
248
254
def resolve_includes (self , workspace , path : str = None ):
249
255
file_dir = os .path .dirname (self .path )
0 commit comments