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 void terminate() throws AnalysisException { throw new AnalysisException("Invalid record invariant - transformation cannot be applied. See error log."); }
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; }
} catch (org.overture.codegen.ir.analysis.AnalysisException e) { System.err.println("Error generating Isabelle sources:"); System.err.println(e.getMessage()); System.exit(1);
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 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 boolean rightHandSideMayBeNull(SExpIR exp) { IsValChecker checker = new IsValChecker(); try { return !exp.apply(checker); } catch (AnalysisException e) { e.printStackTrace(); return false; } }
public SStmIR getEnclosingStm(INode node, String nodeStr) throws AnalysisException { SStmIR enclosingStm = findEnclosingStm(node); if (enclosingStm == null) { new AnalysisException(String.format("Could not find enclosing statement for %s", node)); } return enclosingStm; } }
+ e.getMessage()); e.printStackTrace(); + e.getMessage()); e.printStackTrace();
private void calcDependencies() { try { this.deps = depUtils.calDepsAsGraph(funcs); } catch (AnalysisException e) { e.printStackTrace(); } groupDeps(); }
public String formatName(INode node) throws AnalysisException { if (node instanceof ANewExpIR) { ANewExpIR newExp = (ANewExpIR) node; return formatTypeName(node, newExp.getName()); } else if (node instanceof ARecordTypeIR) { ARecordTypeIR record = (ARecordTypeIR) node; ATypeNameIR typeName = record.getName(); return formatTypeName(node, typeName); } throw new AnalysisException("Unexpected node in formatName: " + node.getClass().getName()); }
+ e.getMessage()); e.printStackTrace();
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; }
public GeneratedModule generateIsabelleSyntax(PExp exp) throws AnalysisException, org.overture.codegen.ir.analysis.AnalysisException { IRStatus<SExpIR> status = this.generator.generateFrom(exp); if (status.canBeGenerated()) { return prettyPrint(status); } throw new org.overture.codegen.ir.analysis.AnalysisException(exp.toString() + " cannot be code-generated"); }
+ 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();
/** * 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(); } }
public String hackResultName(AFuncDeclIR func) throws AnalysisException { SourceNode x = func.getSourceNode(); if (x.getVdmNode() instanceof AImplicitFunctionDefinition) { AImplicitFunctionDefinition iFunc = (AImplicitFunctionDefinition) x.getVdmNode(); return iFunc.getResult().getPattern().toString(); } throw new AnalysisException("Expected AFuncDeclIR in implicit function source. Got: " + x.getVdmNode().getClass().toString()); }
/** * 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 static String vdmExp2IsaString(PExp exp) throws AnalysisException, org.overture.codegen.ir.analysis.AnalysisException { IsaGen ig = new IsaGen(); GeneratedModule r = ig.generateIsabelleSyntax(exp); if (r.hasMergeErrors()) { throw new org.overture.codegen.ir.analysis.AnalysisException(exp.toString() + " cannot be generated. Merge errors:" + r.getMergeErrors().toString()); } if (r.hasUnsupportedIrNodes()) { throw new org.overture.codegen.ir.analysis.AnalysisException(exp.toString() + " cannot be generated. Unsupported in IR:" + r.getUnsupportedInIr().toString()); } if (r.hasUnsupportedTargLangNodes()) { throw new org.overture.codegen.ir.analysis.AnalysisException(exp.toString() + " cannot be generated. Unsupported in TargLang:" + r.getUnsupportedInTargLang().toString()); } return r.getContent(); }
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(); }