@@ -180,23 +180,23 @@ def _handle_unary_op(
180180 logger .error ("Only 'not' and '-' unary operators are supported" )
181181 return None
182182
183- operand = eval_expr (
184- func , module , builder , expr .operand , local_sym_tab , map_sym_tab , structs_sym_tab
183+ from pythonbpf .binary_ops import get_operand_value
184+
185+ operand = get_operand_value (
186+ func , module , expr .operand , builder , local_sym_tab , map_sym_tab , structs_sym_tab
185187 )
186188 if operand is None :
187189 logger .error ("Failed to evaluate operand for unary operation" )
188190 return None
189191
190- operand_val , operand_type = operand
191-
192192 if isinstance (expr .op , ast .Not ):
193193 true_const = ir .Constant (ir .IntType (1 ), 1 )
194- result = builder .xor (convert_to_bool (builder , operand_val ), true_const )
194+ result = builder .xor (convert_to_bool (builder , operand ), true_const )
195195 return result , ir .IntType (1 )
196196 elif isinstance (expr .op , ast .USub ):
197197 # Multiply by -1
198198 neg_one = ir .Constant (ir .IntType (64 ), - 1 )
199- result = builder .mul (operand_val , neg_one )
199+ result = builder .mul (operand , neg_one )
200200 return result , ir .IntType (64 )
201201
202202
0 commit comments