mirror of
https://github.com/varun-r-mallya/Python-BPF.git
synced 2025-12-31 21:06:25 +00:00
WIP: allow pointer assignments to var
This commit is contained in:
@ -1,4 +1,4 @@
|
||||
from .expr_pass import eval_expr, handle_expr
|
||||
from .type_normalization import convert_to_bool
|
||||
from .type_normalization import convert_to_bool, get_base_type_and_depth
|
||||
|
||||
__all__ = ["eval_expr", "handle_expr", "convert_to_bool"]
|
||||
__all__ = ["eval_expr", "handle_expr", "convert_to_bool", "get_base_type_and_depth"]
|
||||
|
||||
@ -16,7 +16,7 @@ COMPARISON_OPS = {
|
||||
}
|
||||
|
||||
|
||||
def _get_base_type_and_depth(ir_type):
|
||||
def get_base_type_and_depth(ir_type):
|
||||
"""Get the base type for pointer types."""
|
||||
cur_type = ir_type
|
||||
depth = 0
|
||||
@ -88,8 +88,8 @@ def _normalize_types(func, builder, lhs, rhs):
|
||||
logger.error(f"Type mismatch: {lhs.type} vs {rhs.type}")
|
||||
return None, None
|
||||
else:
|
||||
lhs_base, lhs_depth = _get_base_type_and_depth(lhs.type)
|
||||
rhs_base, rhs_depth = _get_base_type_and_depth(rhs.type)
|
||||
lhs_base, lhs_depth = get_base_type_and_depth(lhs.type)
|
||||
rhs_base, rhs_depth = get_base_type_and_depth(rhs.type)
|
||||
if lhs_base == rhs_base:
|
||||
if lhs_depth < rhs_depth:
|
||||
rhs = _deref_to_depth(func, builder, rhs, rhs_depth - lhs_depth)
|
||||
|
||||
Reference in New Issue
Block a user