public AMethodDeclIR getInvMethod(ATypeDeclIR typeDecl) { if (typeDecl.getInv() instanceof AMethodDeclIR) { return (AMethodDeclIR) typeDecl.getInv(); } else if (typeDecl.getInv() != null) { log.error("Expected named type invariant function " + "to be a method declaration at this point. Got: " + typeDecl.getDecl()); } return null; }
public String hackInv(ANamedTypeDeclIR type) { ATypeDeclIR tDecl = (ATypeDeclIR) type.parent(); if (tDecl.getInv() != null) { AFuncDeclIR invFunc = (AFuncDeclIR) tDecl.getInv(); StringBuilder sb = new StringBuilder(); sb.append("inv "); sb.append(invFunc.getFormalParams().get(0).getPattern().toString()); sb.append(" == "); sb.append(invFunc.getName()); sb.append("("); sb.append("&"); sb.append(invFunc.getFormalParams().get(0).getPattern().toString()); sb.append(")"); return sb.toString(); } return ""; }
/** * Called by the {@link ATypeDeclIR} node from {@link ATypeDeclIR#apply(IAnalysis)}. * @param node the calling {@link ATypeDeclIR} node */ public void caseATypeDeclIR(ATypeDeclIR node, Q question) throws AnalysisException { _visitedNodes.add(node); inATypeDeclIR(node, question); if(node.getInv() != null && !_visitedNodes.contains(node.getInv())) { node.getInv().apply(this, question); } if(node.getDecl() != null && !_visitedNodes.contains(node.getDecl())) { node.getDecl().apply(this, question); } outATypeDeclIR(node, question); }
/** * Called by the {@link ATypeDeclIR} node from {@link ATypeDeclIR#apply(IAnalysis)}. * @param node the calling {@link ATypeDeclIR} node */ public void caseATypeDeclIR(ATypeDeclIR node) throws AnalysisException { _visitedNodes.add(node); inATypeDeclIR(node); if(node.getInv() != null && !_visitedNodes.contains(node.getInv())) { node.getInv().apply(this); } if(node.getDecl() != null && !_visitedNodes.contains(node.getDecl())) { node.getDecl().apply(this); } outATypeDeclIR(node); }
/** * Called by the {@link ATypeDeclIR} node from {@link ATypeDeclIR#apply(IIsaAnalysis)}. * @param node the calling {@link ATypeDeclIR} node */ public void caseATypeDeclIR(ATypeDeclIR node) throws AnalysisException { _visitedNodes.add(node); inATypeDeclIR(node); if(node.getInv() != null && !_visitedNodes.contains(node.getInv())) { node.getInv().apply(this); } if(node.getDecl() != null && !_visitedNodes.contains(node.getDecl())) { node.getDecl().apply(this); } outATypeDeclIR(node); }
/** * Called by the {@link ATypeDeclIR} node from {@link ATypeDeclIR#apply(IAnalysis)}. * @param node the calling {@link ATypeDeclIR} node */ public A caseATypeDeclIR(ATypeDeclIR node) throws AnalysisException { _visitedNodes.add(node); A retVal = createNewReturnValue(node); mergeReturns(retVal,inATypeDeclIR(node)); if(node.getInv() != null && !_visitedNodes.contains(node.getInv())) { mergeReturns(retVal,node.getInv().apply(this)); } if(node.getDecl() != null && !_visitedNodes.contains(node.getDecl())) { mergeReturns(retVal,node.getDecl().apply(this)); } mergeReturns(retVal,outATypeDeclIR(node)); return retVal; }
/** * Called by the {@link ATypeDeclIR} node from {@link ATypeDeclIR#apply(IAnalysis)}. * @param node the calling {@link ATypeDeclIR} node */ public A caseATypeDeclIR(ATypeDeclIR node, Q question) throws AnalysisException { _visitedNodes.add(node); A retVal = createNewReturnValue(node, question); mergeReturns(retVal,inATypeDeclIR(node, question)); if(node.getInv() != null && !_visitedNodes.contains(node.getInv())) { mergeReturns(retVal,node.getInv().apply(this, question)); } if(node.getDecl() != null && !_visitedNodes.contains(node.getDecl())) { mergeReturns(retVal,node.getDecl().apply(this, question)); } mergeReturns(retVal,outATypeDeclIR(node, question)); return retVal; }