code: protected GeneratedModule genIrModule(MergeVisitor mergeVisitor,
  			IRStatus<? extends PIR> status)
  			throws org.overture.codegen.ir.analysis.AnalysisException
  	{
  		if (status.canBeGenerated())
  		{
  			mergeVisitor.init();
  			StringWriter writer = new StringWriter();
  			status.getIrNode().apply(mergeVisitor, writer);
  
  			boolean isTestCase = isTestCase(status);
  
  			GeneratedModule generatedModule;
  			if (mergeVisitor.hasMergeErrors())
  			{
  				generatedModule = new GeneratedModule(status.getIrNodeName(), status.getIrNode(), mergeVisitor.getMergeErrors(), isTestCase);
  			} else if (mergeVisitor.hasUnsupportedTargLangNodes())
  			{
  				generatedModule = new GeneratedModule(status.getIrNodeName(), new HashSet<VdmNodeInfo>(), mergeVisitor.getUnsupportedInTargLang(), isTestCase);
  			} else
  			{
  				generatedModule = new GeneratedModule(status.getIrNodeName(), status.getIrNode(), formatCode(writer), isTestCase);
  				generatedModule.setTransformationWarnings(status.getTransformationWarnings());
  			}
  
  			return generatedModule;
  		} else
  		{
  			return new GeneratedModule(status.getIrNodeName(), status.getUnsupportedInIr(), new HashSet<IrNodeInfo>(), isTestCase(status));
  		}
  	}
docs: This method translates an IR module or class into target language code.
  
  @param mergeVisitor
  The visitor that translates the IR module or class into target language code.
  @param status
  The IR status that holds the IR node that we want to code generate.
  @return The generated code and data about what has been generated.
  @throws org.overture.codegen.ir.analysis.AnalysisException
  If something goes wrong during the code generation process.