mirror of
https://github.com/varun-r-mallya/Python-BPF.git
synced 2026-12-06 01:48:35 +00:00
Operator knowledge was spread across three files: the binary-op table (an op_map dict rebuilt inline on every _handle_binary_op_impl call, then extracted to ir_ops.apply_binop for augmented assignment), COMPARISON_OPS in type_normalization.py, and the unary/boolean operators as isinstance chains in expr_pass.py. Anyone asking "which operators does PythonBPF support" had to read all three. They now live in one module. BINOP_METHODS and COMPARISON_OPS are the tables themselves; UNARY_OPS and BOOL_OPS list the operators whose lowering is structural (convert_to_bool, short-circuit control flow) so the registry is complete even where the emission stays in expr_pass. apply_binop moves here from ir_ops, which goes back to being purely about IR operations. No behaviour change: 133 passed, 19 xfailed before and after. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BSDVsZH5NtoASyxB8FCtGU
20 lines
584 B
Python
20 lines
584 B
Python
from .expr_pass import eval_expr, handle_expr, get_operand_value
|
|
from .type_normalization import convert_to_bool, get_base_type_and_depth
|
|
from .ir_ops import deref_to_depth, access_struct_field
|
|
from .operators import apply_binop
|
|
from .call_registry import CallHandlerRegistry
|
|
from .vmlinux_registry import VmlinuxHandlerRegistry
|
|
|
|
__all__ = [
|
|
"eval_expr",
|
|
"handle_expr",
|
|
"convert_to_bool",
|
|
"get_base_type_and_depth",
|
|
"deref_to_depth",
|
|
"apply_binop",
|
|
"access_struct_field",
|
|
"get_operand_value",
|
|
"CallHandlerRegistry",
|
|
"VmlinuxHandlerRegistry",
|
|
]
|