-
Notifications
You must be signed in to change notification settings - Fork 3
Refactor conds #26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactor conds #26
Conversation
|
A couple of failing tests which do have reliable syntax workarounds, so added their fixes as TODOs for now. |
|
I think this should be all for now for refactoring the conditionals and the expr_pass (incidental). We now need to extensively use eval_expr in binops, assignments and statemnet processing. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR refactors conditional expression handling by extracting condition evaluation logic from the functions module into a dedicated expression module. The refactoring improves support for complex conditional expressions including boolean operations, comparisons, and unary operations.
- Moved conditional evaluation logic from
functions_pass.pyto a newexprmodule - Added comprehensive support for boolean operations (
and,or) with proper short-circuiting - Enhanced comparison operations with type normalization and pointer handling
Reviewed Changes
Copilot reviewed 23 out of 23 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
pythonbpf/expr/__init__.py |
New module initialization exposing expression evaluation functions |
pythonbpf/expr/expr_pass.py |
Enhanced expression evaluator with boolean operations, comparisons, and unary operations |
pythonbpf/expr/type_normalization.py |
New utility for type conversion, comparison handling, and pointer dereferencing |
pythonbpf/functions/functions_pass.py |
Simplified condition handling by delegating to expression module |
pythonbpf/helper/helper_utils.py |
Updated import path for expression evaluation |
pythonbpf/maps/maps_pass.py |
Updated import path for debug info |
tests/passing_tests/conditionals/*.py |
New test files for various conditional scenarios |
tests/passing_tests/return/bool.py |
Test file for boolean return values |
tests/failing_tests/conditionals/*.py |
Test files for unsupported conditional patterns |
TODO.md |
Updated task list |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
No description provided.