def modifyIfStmt(self, node):
     statements = ASTModifier.modifyIfStmt(self, node)
     if len(statements) == 1:
         node = statements[0]
         condition_stmts_tuples = []
         for (i, (condition,
                  stmts)) in enumerate(node.condition_stmts_tuples):
             try:
                 value = None
                 if condition:
                     value = evaluate_expression(condition)
             except ParseException:
                 pass
             if value is True:
                 # since the condition is always true it can be replaced with None,
                 # but don't do this for if 1=1 statements since they are used as a workaround for the Kontakt 2 parser buffer overflow
                 if not self.is1equals1(condition):
                     condition = None
                 if len(stmts) > 0:
                     condition_stmts_tuples.append((condition, stmts))
                 break
             if not (value is False or len(stmts) == 0):
                 condition_stmts_tuples.append((condition, stmts))
         # if there's just an else statement left, return its statement list
         if len(condition_stmts_tuples
                ) == 1 and condition_stmts_tuples[0][0] is None:
             return condition_stmts_tuples[0][1]
         elif len(condition_stmts_tuples) == 0:
             return []
         else:
             node.condition_stmts_tuples = condition_stmts_tuples
             return [node]
     else:
         return flatten([self.modify(stmt) for stmt in statements])
 def modifyIfStmt(self, node):
     statements = ASTModifier.modifyIfStmt(self, node)
     if len(statements) == 1:
         node = statements[0]
         condition_stmts_tuples = []
         for (i, (condition, stmts)) in enumerate(node.condition_stmts_tuples):
             try:
                 value = None
                 if condition:
                     value = evaluate_expression(condition)
             except ParseException:
                 pass
             if value is True:
                 # since the condition is always true it can be replaced with None,
                 # but don't do this for if 1=1 statements since they are used as a workaround for the Kontakt 2 parser buffer overflow
                 if not self.is1equals1(condition):
                     condition = None
                 if len(stmts) > 0:
                     condition_stmts_tuples.append((condition, stmts))
                 break
             if not (value is False or len(stmts) == 0):
                 condition_stmts_tuples.append((condition, stmts))
         # if there's just an else statement left, return its statement list
         if len(condition_stmts_tuples) == 1 and condition_stmts_tuples[0][0] is None:
             return condition_stmts_tuples[0][1]
         elif len(condition_stmts_tuples) == 0:
             return []
         else:
             node.condition_stmts_tuples = condition_stmts_tuples
             return [node]
     else:
         return flatten([self.modify(stmt) for stmt in statements])
 def modifyIfStmt(self, node):
     if self.pass_num == 2:
         node = ASTModifier.modifyIfStmt(self, node)[0]
         node.condition_stmts_tuples = [
             (condition, self.fixStatementList(stmts))
             for (condition, stmts) in node.condition_stmts_tuples
         ]
     return [node]
 def modifyIfStmt(self, node):
     if self.pass_num == 2:
         node = ASTModifier.modifyIfStmt(self, node)[0]
         node.condition_stmts_tuples = [(condition, self.fixStatementList(stmts)) for (condition, stmts) in node.condition_stmts_tuples]
     return [node]