Interpret bools as ints in binops

This commit is contained in:
Pragyansh Chaturvedi
2025-10-11 00:18:11 +05:30
parent a756f5e4b7
commit 317575644f

View File

@ -21,7 +21,7 @@ def get_operand_value(func, operand, builder, local_sym_tab):
raise ValueError(f"Undefined variable: {operand.id}")
elif isinstance(operand, ast.Constant):
if isinstance(operand.value, int):
cst = ir.Constant(ir.IntType(64), operand.value)
cst = ir.Constant(ir.IntType(64), int(operand.value))
return cst, [cst], None
raise TypeError(f"Unsupported constant type: {type(operand.value)}")
elif isinstance(operand, ast.BinOp):