Jikka-5.0.11.1: A transpiler from Python to C++ for competitive programming
Copyright(c) Kimiyuki Onaka 2021
LicenseApache License 2.0
Maintainerkimiyuki95@gmail.com
Stabilityexperimental
Portabilityportable
Safe HaskellNone
LanguageHaskell2010

Jikka.RestrictedPython.Convert.RemoveUnbalancedIf

Description

 
Synopsis

Documentation

run :: Program -> Program Source #

run removes if-statements that one branch always returns and the other branch doesn't.

For example, the following

if True:
    return 0
else:
    a = 0
b = 1
return 2

is converted to

if True:
    return 0
else:
    a = 0
    b = 1
    return 2