Allow non-call convention for maps

This commit is contained in:
Pragyansh Chaturvedi
2025-10-02 22:07:28 +05:30
parent 9dbca410c2
commit 6e4c340780
2 changed files with 18 additions and 2 deletions

View File

@ -192,8 +192,23 @@ def handle_assign(
elif isinstance(rval.func, ast.Attribute):
print(f"Assignment call attribute: {ast.dump(rval.func)}")
if isinstance(rval.func.value, ast.Name):
# TODO: probably a struct access
print(f"TODO STRUCT ACCESS {ast.dump(rval)}")
if rval.func.value.id in map_sym_tab:
map_name = rval.func.value.id
method_name = rval.func.attr
if HelperHandlerRegistry.has_handler(method_name):
val = handle_helper_call(
rval,
module,
builder,
func,
local_sym_tab,
map_sym_tab,
structs_sym_tab,
)
builder.store(val[0], local_sym_tab[var_name].var)
else:
# TODO: probably a struct access
print(f"TODO STRUCT ACCESS {ast.dump(rval)}")
elif isinstance(rval.func.value, ast.Call) and isinstance(
rval.func.value.func, ast.Name
):

View File

@ -274,6 +274,7 @@ def process_bpf_map(func_node, module):
rval = return_stmt.value
if isinstance(rval, ast.Call) and isinstance(rval.func, ast.Name):
print(f"we're lit, {ast.dump(rval)}")
handler = MapProcessorRegistry.get_processor(rval.func.id)
if handler:
return handler(map_name, rval, module)