public static String getIfString(AIfStm node) { StringBuilder sb = new StringBuilder(); sb.append("if " + node.getIfExp() + "\nthen\n" + node.getThenStm()); for (AElseIfStm s : node.getElseIf()) { sb.append(s.toString()); } if (node.getElseStm() != null) { sb.append("else\n"); sb.append(node.getElseStm().toString()); } return sb.toString(); }
@Override public PExp caseAIfStm(AIfStm stm, Integer lineno) throws AnalysisException { PExp found = stm.getThenStm().apply(THIS, lineno); if (found != null) { return found; } for (AElseIfStm stmt : stm.getElseIf()) { found = stmt.apply(THIS, lineno); if (found != null) { return found; } } if (stm.getElseStm() != null) { found = stm.getElseStm().apply(THIS, lineno); } return found; }
@Override public PStm caseAIfStm(AIfStm stm, Integer lineno) throws AnalysisException { PStm found = findStatementBaseCase(stm, lineno); if (found != null) { return found; } found = stm.getThenStm().apply(THIS, lineno);// PStmAssistantInterpreter.findStatement(stm.getThenStm(), // lineno); if (found != null) { return found; } for (AElseIfStm stmt : stm.getElseIf()) { found = stmt.apply(THIS, lineno);// af.createPStmAssistant().findStatement(stmt, lineno); if (found != null) { return found; } } if (stm.getElseStm() != null) { found = stm.getElseStm().apply(THIS, lineno);// PStmAssistantInterpreter.findStatement(stm.getElseStm(), // lineno); } return found; }
@Override public Value caseAIfStm(AIfStm node, Context ctxt) throws AnalysisException { return evalIf(node, node.getLocation(), node.getIfExp(), node.getThenStm(), node.getElseIf(), node.getElseStm(), ctxt); }
if(node.getElseStm() != null && !_visitedNodes.contains(node.getElseStm())) node.getElseStm().apply(this);
@Override public PTypeSet caseAIfStm(AIfStm statement) throws AnalysisException { PTypeSet types = new PTypeSet(af); types.addAll(statement.getThenStm().apply(THIS)); for (AElseIfStm stmt : statement.getElseIf()) { types.addAll(stmt.apply(THIS)); } if (statement.getElseStm() != null) { types.addAll(statement.getElseStm().apply(THIS)); } return types; }
if(node.getElseStm() != null && !_visitedNodes.contains(node.getElseStm())) node.getElseStm().apply(this);
if(node.getElseStm() != null && !_visitedNodes.contains(node.getElseStm())) node.getElseStm().apply(this, question);
@Override public IProofObligationList caseAIfStm(AIfStm node, IPOContextStack question) throws AnalysisException { try { IProofObligationList obligations = node.getIfExp().apply(rootVisitor, question); obligations.addAll(node.getThenStm().apply(mainVisitor, question)); for (AElseIfStm stmt : node.getElseIf()) { obligations.addAll(stmt.apply(mainVisitor, question)); } if (node.getElseStm() != null) { obligations.addAll(node.getElseStm().apply(mainVisitor, question)); } return obligations; } catch (Exception e) { throw new POException(node, e.getMessage()); } }
@Override public PType caseAIfStm(AIfStm node, TypeCheckInfo question) throws AnalysisException { node.setType(typeCheckIf(node.getLocation(), node.getIfExp(), node.getThenStm(), node.getElseIf(), node.getElseStm(), question));//rtypes.getType(node.getLocation())); return node.getType(); }
if(node.getElseStm() != null && !_visitedNodes.contains(node.getElseStm())) mergeReturns(retVal,node.getElseStm().apply(this));
if(node.getElseStm() != null && !_visitedNodes.contains(node.getElseStm())) mergeReturns(retVal,node.getElseStm().apply(this, question));
@Override public SStmIR caseAIfStm(AIfStm node, IRInfo question) throws AnalysisException { SExpIR ifExp = node.getIfExp().apply(question.getExpVisitor(), question); SStmIR thenStm = node.getThenStm().apply(question.getStmVisitor(), question); AIfStmIR ifStm = new AIfStmIR(); ifStm.setIfExp(ifExp); ifStm.setThenStm(thenStm); LinkedList<AElseIfStm> elseIfs = node.getElseIf(); for (AElseIfStm stm : elseIfs) { ifExp = stm.getElseIf().apply(question.getExpVisitor(), question); thenStm = stm.getThenStm().apply(question.getStmVisitor(), question); AElseIfStmIR elseIfStm = new AElseIfStmIR(); elseIfStm.setElseIf(ifExp); elseIfStm.setThenStm(thenStm); ifStm.getElseIf().add(elseIfStm); } if (node.getElseStm() != null) { SStmIR elseStm = node.getElseStm().apply(question.getStmVisitor(), question); ifStm.setElseStm(elseStm); } return ifStm; }