Reduce a condition from handle_cond

This commit is contained in:
Pragyansh Chaturvedi
2025-10-06 22:20:54 +05:30
committed by varun-r-mallya
parent 9d73eb67c4
commit f46e7cd846

View File

@ -242,9 +242,7 @@ def handle_assign(
def handle_cond(func, module, builder, cond, local_sym_tab, map_sym_tab):
if isinstance(cond, ast.Constant):
if isinstance(cond.value, bool):
return ir.Constant(ir.IntType(1), int(cond.value))
elif isinstance(cond.value, int):
if isinstance(cond.value, bool) or isinstance(cond.value, int):
return ir.Constant(ir.IntType(1), int(bool(cond.value)))
else:
logger.info("Unsupported constant type in condition")