We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 3f06175 commit be05b5dCopy full SHA for be05b5d
pythonbpf/functions_pass.py
@@ -417,6 +417,19 @@ def process_stmt(
417
)
418
builder.ret(val[0])
419
did_return = True
420
+ elif isinstance(stmt.value.args[0], ast.Name):
421
+ if stmt.value.args[0].id in local_sym_tab:
422
+ var = local_sym_tab[stmt.value.args[0].id].var
423
+ val = builder.load(var)
424
+ if val.type != ret_type:
425
+ raise ValueError(
426
+ "Return type mismatch: expected"
427
+ f"{ret_type}, got {val.type}"
428
+ )
429
+ builder.ret(val)
430
+ did_return = True
431
+ else:
432
+ raise ValueError("Failed to evaluate return expression")
433
elif isinstance(stmt.value, ast.Name):
434
if stmt.value.id == "XDP_PASS":
435
builder.ret(ir.Constant(ret_type, 2))
0 commit comments