#NEWLINE# def generateConditionCode( condition , emit , context ) : #NEWLINE# #INDENT# if condition . isExpressionConstantRef ( ) : #NEWLINE# #INDENT# assert False #NEWLINE# value = condition . getConstant ( ) #NEWLINE# if value : #NEWLINE# #INDENT# getGotoCode ( context . getTrueBranchTarget ( ) , emit ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# getGotoCode ( context . getFalseBranchTarget ( ) , emit ) #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# if condition . isExpressionComparison ( ) : #NEWLINE# #INDENT# left_name = context . allocateTempName ( 'compare_left' ) #NEWLINE# generateExpressionCode ( to_name = left_name , expression = condition . getLeft ( ) , emit = emit , context = context ) #NEWLINE# right_name = context . allocateTempName ( 'compare_right' ) #NEWLINE# generateExpressionCode ( to_name = right_name , expression = condition . getRight ( ) , emit = emit , context = context ) #NEWLINE# old_source_ref = context . setCurrentSourceCodeReference ( condition . getSourceReference ( ) ) #NEWLINE# getComparisonExpressionBoolCode ( comparator = condition . getComparator ( ) , left_name = left_name , right_name = right_name , needs_check = condition . mayRaiseExceptionBool ( BaseException ) , emit = emit , context = context ) #NEWLINE# context . setCurrentSourceCodeReference ( old_source_ref ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if condition . isExpressionOperationNOT ( ) : #NEWLINE# #INDENT# true_target = context . getTrueBranchTarget ( ) #NEWLINE# false_target = context . getFalseBranchTarget ( ) #NEWLINE# context . setTrueBranchTarget ( false_target ) #NEWLINE# context . setFalseBranchTarget ( true_target ) #NEWLINE# generateConditionCode ( condition = condition . getOperand ( ) , emit = emit , context = context ) #NEWLINE# context . setTrueBranchTarget ( true_target ) #NEWLINE# context . setFalseBranchTarget ( false_target ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if condition . isExpressionConditional ( ) : #NEWLINE# #INDENT# expression_yes = condition . getExpressionYes ( ) #NEWLINE# expression_no = condition . getExpressionNo ( ) #NEWLINE# condition = condition . getCondition ( ) #NEWLINE# old_true_target = context . getTrueBranchTarget ( ) #NEWLINE# old_false_target = context . getFalseBranchTarget ( ) #NEWLINE# select_true = context . allocateLabel ( 'select_true' ) #NEWLINE# select_false = context . allocateLabel ( 'select_false' ) #NEWLINE# select_end = context . allocateLabel ( 'select_end' ) #NEWLINE# context . setTrueBranchTarget ( select_true ) #NEWLINE# context . setFalseBranchTarget ( select_false ) #NEWLINE# generateConditionCode ( condition = condition , emit = emit , context = context ) #NEWLINE# context . setTrueBranchTarget ( old_true_target ) #NEWLINE# context . setFalseBranchTarget ( old_false_target ) #NEWLINE# getLabelCode ( select_true , emit ) #NEWLINE# generateConditionCode ( condition = expression_yes , emit = emit , context = context ) #NEWLINE# getGotoCode ( select_end , emit ) #NEWLINE# getLabelCode ( select_false , emit ) #NEWLINE# generateConditionCode ( condition = expression_no , emit = emit , context = context ) #NEWLINE# getLabelCode ( select_end , emit ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if condition . isExpressionBuiltinHasattr ( ) : #NEWLINE# #INDENT# source_name = context . allocateTempName ( 'hasattr_source' ) #NEWLINE# attr_name = context . allocateTempName ( 'hasattr_attr' ) #NEWLINE# generateExpressionCode ( to_name = source_name , expression = condition . getLookupSource ( ) , emit = emit , context = context ) #NEWLINE# generateExpressionCode ( to_name = attr_name , expression = condition . getAttribute ( ) , emit = emit , context = context ) #NEWLINE# old_source_ref = context . setCurrentSourceCodeReference ( ( condition . getAttribute ( ) . getSourceReference ( ) if Options . isFullCompat ( ) else condition . getSourceReference ( ) ) ) #NEWLINE# getAttributeCheckBoolCode ( source_name = source_name , attr_name = attr_name , needs_check = condition . getLookupSource ( ) . mayRaiseExceptionAttributeCheckObject ( exception_type = BaseException , attribute = condition . getAttribute ( ) ) , emit = emit , context = context ) #NEWLINE# context . setCurrentSourceCodeReference ( old_source_ref ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if condition . isExpressionBuiltinIsinstance ( ) : #NEWLINE# #INDENT# inst_name = context . allocateTempName ( 'isinstance_inst' ) #NEWLINE# cls_name = context . allocateTempName ( 'isinstance_cls' ) #NEWLINE# generateExpressionCode ( to_name = inst_name , expression = condition . getInstance ( ) , emit = emit , context = context ) #NEWLINE# generateExpressionCode ( to_name = cls_name , expression = condition . getCls ( ) , emit = emit , context = context ) #NEWLINE# old_source_ref = context . setCurrentSourceCodeReference ( condition . getSourceReference ( ) ) #NEWLINE# getBuiltinIsinstanceBoolCode ( inst_name = inst_name , cls_name = cls_name , emit = emit , context = context ) #NEWLINE# context . setCurrentSourceCodeReference ( expression_yes ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# condition_name = context . allocateTempName ( 'cond_value' ) #NEWLINE# truth_name = context . allocateTempName ( 'cond_truth' , 'int' ) #NEWLINE# generateExpressionCode ( to_name = condition_name , expression = condition , emit = emit , context = context ) #NEWLINE# old_source_ref = context . setCurrentSourceCodeReference ( condition . getSourceReference ( ) ) #NEWLINE# getConditionCheckTrueCode ( to_name = truth_name , value_name = condition_name , needs_check = condition . mayRaiseExceptionBool ( BaseException ) , emit = emit , context = context ) #NEWLINE# context . setCurrentSourceCodeReference ( old_source_ref ) #NEWLINE# getReleaseCode ( release_name = condition_name , emit = emit , context = context ) #NEWLINE# getBranchingCode ( condition = ( '%s == 1' % truth_name ) , emit = emit , context = context )