Skip to content

Commit f98491f

Browse files
committed
Add handle_and and handle_or handling stub in eval_expr
1 parent 98f262a commit f98491f

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

pythonbpf/expr_pass.py

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -315,6 +315,14 @@ def _handle_unary_op(
315315
return result, ir.IntType(1)
316316

317317

318+
def _handle_and_op(func, builder, expr, local_sym_tab, map_sym_tab, structs_sym_tab):
319+
pass
320+
321+
322+
def _handle_or_op(func, builder, expr, local_sym_tab, map_sym_tab, structs_sym_tab):
323+
pass
324+
325+
318326
def _handle_boolean_op(
319327
func,
320328
module,
@@ -324,7 +332,19 @@ def _handle_boolean_op(
324332
map_sym_tab,
325333
structs_sym_tab=None,
326334
):
327-
pass
335+
"""Handle `and` and `or` boolean operations."""
336+
337+
if isinstance(expr.op, ast.And):
338+
return _handle_and_op(
339+
func, builder, expr, local_sym_tab, map_sym_tab, structs_sym_tab
340+
)
341+
elif isinstance(expr.op, ast.Or):
342+
return _handle_or_op(
343+
func, builder, expr, local_sym_tab, map_sym_tab, structs_sym_tab
344+
)
345+
else:
346+
logger.error(f"Unsupported boolean operator: {type(expr.op).__name__}")
347+
return None
328348

329349

330350
def eval_expr(

0 commit comments

Comments
 (0)