protected Generated genIrExp ( IRStatus < SExpIR > expStatus , MergeVisitor mergeVisitor ) throws org . overture . codegen . ir . analysis . AnalysisException { StringWriter writer = new StringWriter ( ) ; SExpIR expCg = expStatus . getIrNode ( ) ; if ( expStatus . canBeGenerated ( ) ) { mergeVisitor . init ( ) ; expCg . apply ( mergeVisitor , writer ) ; if ( mergeVisitor . hasMergeErrors ( ) ) { return new Generated ( mergeVisitor . getMergeErrors ( ) ) ; } else if ( mergeVisitor . hasUnsupportedTargLangNodes ( ) ) { return new Generated ( new HashSet < VdmNodeInfo > ( ) , mergeVisitor . getUnsupportedInTargLang ( ) ) ; } else { String code = writer . toString ( ) ; return new Generated ( code ) ; } } else { return new Generated ( expStatus . getUnsupportedInIr ( ) , new HashSet < IrNodeInfo > ( ) ) ; } }
Translates an IR expression into target language code .