Fix fstrings in examples, add alternate map attr access

This commit is contained in:
Pragyansh Chaturvedi
2025-10-02 00:22:59 +05:30
parent d4e8e1bf73
commit 6831f11179
2 changed files with 7 additions and 4 deletions

View File

@ -255,11 +255,14 @@ def handle_helper_call(call, module, builder, func,
elif isinstance(call.func, ast.Attribute):
method_name = call.func.attr
value = call.func.value
print(f"Handling method call: {ast.dump(call.func)}")
# Get map pointer from different styles of map access
if isinstance(value, ast.Call) and isinstance(value.func, ast.Name):
# Variable style: my_map.lookup(key)
# Func style: my_map().lookup(key)
map_name = value.func.id
elif isinstance(value, ast.Name):
# Direct style: my_map.lookup(key)
map_name = value.id
else:
raise NotImplementedError(
f"Unsupported map access pattern: {ast.dump(value)}")