/** * Called by the {@link AElseIfExp} node from {@link AElseIfExp#apply(IPOFAnalysis)}. * @param node the calling {@link AElseIfExp} node */ public void caseAElseIfExp(AElseIfExp node) throws AnalysisException { _visitedNodes.add(node); inAElseIfExp(node); if(node.getType() != null && !_visitedNodes.contains(node.getType())) { node.getType().apply(this); } if(node.getElseIf() != null && !_visitedNodes.contains(node.getElseIf())) { node.getElseIf().apply(this); } if(node.getThen() != null && !_visitedNodes.contains(node.getThen())) { node.getThen().apply(this); } outAElseIfExp(node); }
@Override public PType caseAElseIfExp(AElseIfExp node, TypeCheckInfo question) throws AnalysisException { node.setType(typeCheckAElseIf(node, node.getLocation(), node.getElseIf(), node.getThen(), question)); return node.getType(); }
public static AElseIfExp newAElseIfExp(ILexLocation start, PExp elseIfExp, PExp thenExp) { AElseIfExp result = new AElseIfExp(); initExpression(result, start); result.setElseIf(elseIfExp); result.setThen(thenExp); return result; }
/** * Returns a deep clone of this {@link AElseIfExp} node. * @return a deep clone of this {@link AElseIfExp} node */ public AElseIfExp clone() { return new AElseIfExp( _type, _location, cloneNode(_elseIf), cloneNode(_then) ); }
@Override public Value caseAElseIfExp(AElseIfExp node, Context ctxt) throws AnalysisException { return evalElseIf(node, node.getLocation(), node.getElseIf(), node.getThen(), ctxt); }
@Override public List<PExp> caseAIfExp(AIfExp exp) throws AnalysisException { List<PExp> subs = exp.getTest().apply(THIS); subs.addAll(exp.getThen().apply(THIS)); for (AElseIfExp elif : exp.getElseList()) { subs.addAll(elif.apply(THIS)); } if (exp.getElse() != null) { subs.addAll(exp.getElse().apply(THIS)); } subs.add(exp); return subs; }
@Override public IProofObligationList caseAIfExp(AIfExp node, IPOContextStack question) throws AnalysisException { IProofObligationList obligations = node.getTest().apply(mainVisitor, question); question.push(new POImpliesContext(node.getTest())); obligations.addAll(node.getThen().apply(mainVisitor, question)); question.pop(); question.push(new PONotImpliesContext(node.getTest())); for (AElseIfExp e : node.getElseList()) { obligations.addAll(e.apply(mainVisitor, question)); question.push(new PONotImpliesContext(e.getElseIf())); } int sizeBefore = question.size(); obligations.addAll(node.getElse().apply(mainVisitor, question)); assert sizeBefore <= question.size(); for (int i = 0; i < node.getElseList().size(); i++) { question.pop(); } question.pop(); return obligations; }
@Override public PExp caseAElseIfExp(AElseIfExp exp, Integer lineno) throws AnalysisException { PExp found = findExpressionBaseCase(exp, lineno); if (found != null) { return found; } return exp.getThen().apply(THIS, lineno);// PExpAssistantInterpreter.findExpression(exp.getThen(), lineno); }
e.apply(this, question);
/** * Creates a deep clone of this {@link AElseIfExp} node while putting all * old node-new node relations in the map {@code oldToNewMap}. * @param oldToNewMap the map filled with the old node-new node relation * @return a deep clone of this {@link AElseIfExp} node */ public AElseIfExp clone(Map<INode,INode> oldToNewMap) { AElseIfExp node = new AElseIfExp( _type, _location, cloneNode(_elseIf, oldToNewMap), cloneNode(_then, oldToNewMap) ); oldToNewMap.put(this, node); return node; }
/** * Called by the {@link AElseIfExp} node from {@link AElseIfExp#apply(IAnalysis)}. * @param node the calling {@link AElseIfExp} node */ public void caseAElseIfExp(AElseIfExp node) throws AnalysisException { _visitedNodes.add(node); inAElseIfExp(node); if(node.getType() != null && !_visitedNodes.contains(node.getType())) { node.getType().apply(this); } if(node.getElseIf() != null && !_visitedNodes.contains(node.getElseIf())) { node.getElseIf().apply(this); } if(node.getThen() != null && !_visitedNodes.contains(node.getThen())) { node.getThen().apply(this); } outAElseIfExp(node); }
e.apply(this);
/** * Called by the {@link AElseIfExp} node from {@link AElseIfExp#apply(IAnalysis)}. * @param node the calling {@link AElseIfExp} node */ public void caseAElseIfExp(AElseIfExp node, Q question) throws AnalysisException { _visitedNodes.add(node); inAElseIfExp(node, question); if(node.getType() != null && !_visitedNodes.contains(node.getType())) { node.getType().apply(this, question); } if(node.getElseIf() != null && !_visitedNodes.contains(node.getElseIf())) { node.getElseIf().apply(this, question); } if(node.getThen() != null && !_visitedNodes.contains(node.getThen())) { node.getThen().apply(this, question); } outAElseIfExp(node, question); }
@Override public IProofObligationList caseAElseIfExp(AElseIfExp node, IPOContextStack question) throws AnalysisException { IProofObligationList obligations = new ProofObligationList(); question.push(new POImpliesContext(node.getElseIf())); obligations.addAll(node.getThen().apply(mainVisitor, question)); question.pop(); return obligations; }
e.apply(this);
/** * Called by the {@link AElseIfExp} node from {@link AElseIfExp#apply(IAnalysis)}. * @param node the calling {@link AElseIfExp} node */ public A caseAElseIfExp(AElseIfExp node) throws AnalysisException { _visitedNodes.add(node); A retVal = createNewReturnValue(node); mergeReturns(retVal,inAElseIfExp(node)); if(node.getType() != null && !_visitedNodes.contains(node.getType())) { mergeReturns(retVal,node.getType().apply(this)); } if(node.getElseIf() != null && !_visitedNodes.contains(node.getElseIf())) { mergeReturns(retVal,node.getElseIf().apply(this)); } if(node.getThen() != null && !_visitedNodes.contains(node.getThen())) { mergeReturns(retVal,node.getThen().apply(this)); } mergeReturns(retVal,outAElseIfExp(node)); return retVal; }
mergeReturns(retVal,e.apply(this));