Skip to content

Commit 49ed2cf

Browse files
r41k0uclaude
andcommitted
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>
1 parent ad6adb1 commit 49ed2cf

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

‎pythonbpf/expr/expr_pass.py‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -254,6 +254,7 @@ def get_typed_operand(func, compilation_context, operand, builder, local_sym_tab
254254
vmlinux_result = VmlinuxHandlerRegistry.handle_name(operand.id)
255255
if vmlinux_result is not None:
256256
return vmlinux_result # (i64 constant, its C rank)
257+
raise SyntaxError(f"Undefined variable {operand.id}")
257258
elif isinstance(operand, ast.Constant):
258259
if isinstance(operand.value, (int, bool)):
259260
v = int(operand.value)

0 commit comments

Comments
 (0)