public List<AIdentifierPatternIR> findOccurences() { idOccurences = new LinkedList<AIdentifierPatternIR>(); try { topNode.apply(this); } catch (AnalysisException e) { log.error("Could not find identifier pattern occurences for node: " + topNode); e.printStackTrace(); } return idOccurences; }
private boolean traceIsSupported(TraceSupportedAnalysis supportedAnalysis) { try { supportedAnalysis.run(); } catch (AnalysisException e) { log.error("Could not determine if a trace could be code generated"); e.printStackTrace(); return false; } return !supportedAnalysis.isUnsupported(); }
public boolean rightHandSideMayBeNull(SExpIR exp) { IsValChecker checker = new IsValChecker(); try { return !exp.apply(checker); } catch (AnalysisException e) { e.printStackTrace(); return false; } }
public Map<SDeclIR, List<SDeclIR>> calcDepsAsMap(List<SDeclIR> decls) { Map<SDeclIR, List<SDeclIR>> r = new HashedMap<>(); for (SDeclIR decl : decls) { try { List<SDeclIR> dependencies = findDependencies(decl, decls); if (!dependencies.isEmpty()) { r.put(decl, dependencies); } else { r.put(decl, new Vector<SDeclIR>()); } } catch (AnalysisException e) { e.printStackTrace(); } } return r; }
private void calcDependencies() { try { this.deps = depUtils.calDepsAsGraph(funcs); } catch (AnalysisException e) { e.printStackTrace(); } groupDeps(); }
/** * The record invariant method is generated such that it takes the record instance as an argument, e.g. * inv_Rec(recToCheck). When I try to invoke it from the instance invariant clause as //@ invariant inv_Rec(this); * it crashes on a stackoverflow where it keeps calling the invariant check. Adjusting the invariant method such * that it instead takes the fields as arguments does, however, work. This is exactly what this method does. After * calling this method a call to the invariant method from the invariant will take the following form: //@ public * instance invariant inv_Rec(field1,field2); * * @param rec * The record for which we will change the invariant method */ private void changeRecInvMethod(ARecordDeclIR rec) { try { rec.getInvariant().apply(new RecInvTransformation(javaGen, rec)); } catch (org.overture.codegen.ir.analysis.AnalysisException e) { log.error("Could not transform the invariant method of a record"); e.printStackTrace(); } }
private boolean isDelegateCall(SStmIR body) { DelegateSearch search = new DelegateSearch(); if (body != null) { try { body.apply(search); return search.isDelegateCall(); } catch (AnalysisException e) { e.printStackTrace(); log.error("Unexpected error encountered when checking " + "if method is a delegate call: " + e.getMessage()); } } return false; }
private RecClassInfo makeRecStateAccessorBased(List<IRStatus<PIR>> ast) { RecAccessorTrans recAccTr = new RecAccessorTrans(this); for (IRStatus<PIR> status : ast) { try { javaGen.getIRGenerator().applyPartialTransformation(status, recAccTr); } catch (org.overture.codegen.ir.analysis.AnalysisException e) { log.error("Could not apply '" + RecAccessorTrans.class + "' to status " + status.getIrNodeName()); e.printStackTrace(); } } return recAccTr.getRecInfo(); }
/** * Cleans up an IR status by removing redundant {@link ABlockStmIR} nodes using the {@link BlockCleanupTrans} * transformation. * * @param status * The IR status */ public void cleanup(IRStatus<PIR> status) { if (status != null && status.getIrNode() != null) { try { status.getIrNode().apply(new BlockCleanupTrans()); } catch (org.overture.codegen.ir.analysis.AnalysisException e) { e.printStackTrace(); log.error("Problem encountered when trying to clean up blocks"); } } }
public StateDesInfo normaliseTargets(List<IRStatus<PIR>> newAst) { TargetNormaliserTrans normaliser = new TargetNormaliserTrans(this); for (IRStatus<PIR> n : newAst) { try { javaGen.getIRGenerator().applyPartialTransformation(n, normaliser); } catch (org.overture.codegen.ir.analysis.AnalysisException e) { log.error("Problem normalising state designators: " + e.getMessage()); e.printStackTrace(); } } return normaliser.getStateDesInfo(); }
public Generated generateJavaFromVdmExp(PExp exp) throws AnalysisException, org.overture.codegen.ir.analysis.AnalysisException { // There is no name validation here. IRStatus<SExpIR> expStatus = generator.generateFrom(exp); if (expStatus.canBeGenerated()) { // "expression" generator only supports a single transformation generator.applyPartialTransformation(expStatus, new DivideTrans(getInfo())); } try { return genIrExp(expStatus, javaFormat.getMergeVisitor()); } catch (org.overture.codegen.ir.analysis.AnalysisException e) { log.error("Could not generate expression: " + exp); e.printStackTrace(); return null; } }
private void addAssertions(List<IRStatus<PIR>> newAst, TypePredDecorator assertTr) { for (IRStatus<ADefaultClassDeclIR> status : IRStatus.extract(newAst, ADefaultClassDeclIR.class)) { ADefaultClassDeclIR clazz = status.getIrNode(); if (!this.javaGen.getInfo().getDeclAssistant().isLibraryName(clazz.getName())) { try { this.javaGen.getIRGenerator().applyPartialTransformation(status, assertTr); } catch (org.overture.codegen.ir.analysis.AnalysisException e) { log.error("Unexpected problem occured when applying transformation"); e.printStackTrace(); } } } }
private void sortAnnotations(List<IRStatus<PIR>> newAst) { AnnotationSorter sorter = new AnnotationSorter(); for (IRStatus<ADefaultClassDeclIR> status : IRStatus.extract(newAst, ADefaultClassDeclIR.class)) { if (!javaGen.getInfo().getDeclAssistant().isLibraryName(status.getIrNode().getName())) { try { status.getIrNode().apply(sorter); } catch (org.overture.codegen.ir.analysis.AnalysisException e) { log.error("Could not sort JML annotations for node " + status.getIrNode()); e.printStackTrace(); } } } }
+ status.getIrNodeName() + ": " + e.getMessage()); log.error("Skipping module.."); e.printStackTrace(); + status.getIrNodeName() + ": " + e.getMessage()); log.error("Skipping class.."); e.printStackTrace(); + status.getIrNodeName() + ": " + e.getMessage()); log.error("Skipping module.."); e.printStackTrace(); + status.getIrNodeName() + ": " + e.getMessage()); log.error("Skipping class.."); e.printStackTrace(); + funcValueInterface.getName() + ": " + e.getMessage()); log.error("Skipping interface.."); e.printStackTrace();