mirror of
https://github.com/varun-r-mallya/Python-BPF.git
synced 2026-12-06 01:48:35 +00:00
Core: Report an unknown name in an operand as undefined
get_typed_operand fell through its Name branch for a name that is not a local, a global or a vmlinux constant, and raised the generic "Unsupported operand type" meant for unknown node kinds. Since return goes through it, forgetting `from vmlinux import XDP_PASS` produced that message; it says "Undefined variable XDP_PASS" now, like every other read. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
@ -254,6 +254,7 @@ def get_typed_operand(func, compilation_context, operand, builder, local_sym_tab
|
||||
vmlinux_result = VmlinuxHandlerRegistry.handle_name(operand.id)
|
||||
if vmlinux_result is not None:
|
||||
return vmlinux_result # (i64 constant, its C rank)
|
||||
raise SyntaxError(f"Undefined variable {operand.id}")
|
||||
elif isinstance(operand, ast.Constant):
|
||||
if isinstance(operand.value, (int, bool)):
|
||||
v = int(operand.value)
|
||||
|
||||
Reference in New Issue
Block a user