11import ast
22import logging
3- from typing import List , Tuple
3+ from typing import List , Tuple , Dict
44import importlib
55import inspect
6+
7+ from .dependency_handler import DependencyHandler
8+ from .ir_generation import IRGenerator
69from .vmlinux_class_handler import process_vmlinux_class
710
811logger = logging .getLogger (__name__ )
@@ -75,6 +78,11 @@ def detect_import_statement(tree: ast.AST) -> List[Tuple[str, ast.ImportFrom]]:
7578def vmlinux_proc (tree : ast .AST , module ):
7679 import_statements = detect_import_statement (tree )
7780
81+ # initialise dependency handler
82+ handler = DependencyHandler ()
83+ # initialise assignment dictionary of name to type
84+ assignments : Dict [str , type ] = {}
85+
7886 if not import_statements :
7987 logger .info ("No vmlinux imports found" )
8088 return
@@ -100,19 +108,21 @@ def vmlinux_proc(tree: ast.AST, module):
100108 found = False
101109 for mod_node in mod_ast .body :
102110 if isinstance (mod_node , ast .ClassDef ) and mod_node .name == imported_name :
103- process_vmlinux_class (mod_node , module )
111+ process_vmlinux_class (mod_node , module , handler )
104112 found = True
105113 break
106114 if isinstance (mod_node , ast .Assign ):
107115 for target in mod_node .targets :
108116 if isinstance (target , ast .Name ) and target .id == imported_name :
109- process_vmlinux_assign (mod_node , module )
117+ process_vmlinux_assign (mod_node , module , assignments )
110118 found = True
111119 break
112120 if found :
113121 break
114122 if not found :
115123 logger .info (f"{ imported_name } not found as ClassDef or Assign in vmlinux" )
116124
117- def process_vmlinux_assign (node , module ):
125+ IRGenerator (module , handler )
126+
127+ def process_vmlinux_assign (node , module , assignments : Dict [str , type ]):
118128 raise NotImplementedError ("Assignment handling has not been implemented yet" )
0 commit comments