/** * Called by the {@link ACasesStmIR} node from {@link ACasesStmIR#apply(IAnalysis)}. * @param node the calling {@link ACasesStmIR} node */ public void caseACasesStmIR(ACasesStmIR node) throws AnalysisException { _visitedNodes.add(node); inACasesStmIR(node); if(node.getExp() != null && !_visitedNodes.contains(node.getExp())) { node.getExp().apply(this); } { List<ACaseAltStmStmIR> copy = new ArrayList<ACaseAltStmStmIR>(node.getCases()); for( ACaseAltStmStmIR e : copy) { if(!_visitedNodes.contains(e)) { e.apply(this); } } } if(node.getOthers() != null && !_visitedNodes.contains(node.getOthers())) { node.getOthers().apply(this); } outACasesStmIR(node); }
/** * Called by the {@link ACasesStmIR} node from {@link ACasesStmIR#apply(IAnalysis)}. * @param node the calling {@link ACasesStmIR} node */ public void caseACasesStmIR(ACasesStmIR node, Q question) throws AnalysisException { _visitedNodes.add(node); inACasesStmIR(node, question); if(node.getExp() != null && !_visitedNodes.contains(node.getExp())) { node.getExp().apply(this, question); } { List<ACaseAltStmStmIR> copy = new ArrayList<ACaseAltStmStmIR>(node.getCases()); for( ACaseAltStmStmIR e : copy) { if(!_visitedNodes.contains(e)) { e.apply(this, question); } } } if(node.getOthers() != null && !_visitedNodes.contains(node.getOthers())) { node.getOthers().apply(this, question); } outACasesStmIR(node, question); }
/** * Called by the {@link ACasesStmIR} node from {@link ACasesStmIR#apply(IIsaAnalysis)}. * @param node the calling {@link ACasesStmIR} node */ public void caseACasesStmIR(ACasesStmIR node) throws AnalysisException { _visitedNodes.add(node); inACasesStmIR(node); if(node.getExp() != null && !_visitedNodes.contains(node.getExp())) { node.getExp().apply(this); } { List<ACaseAltStmStmIR> copy = new ArrayList<ACaseAltStmStmIR>(node.getCases()); for( ACaseAltStmStmIR e : copy) { if(!_visitedNodes.contains(e)) { e.apply(this); } } } if(node.getOthers() != null && !_visitedNodes.contains(node.getOthers())) { node.getOthers().apply(this); } outACasesStmIR(node); }
/** * Called by the {@link ACasesStmIR} node from {@link ACasesStmIR#apply(IAnalysis)}. * @param node the calling {@link ACasesStmIR} node */ public A caseACasesStmIR(ACasesStmIR node, Q question) throws AnalysisException { _visitedNodes.add(node); A retVal = createNewReturnValue(node, question); mergeReturns(retVal,inACasesStmIR(node, question)); if(node.getExp() != null && !_visitedNodes.contains(node.getExp())) { mergeReturns(retVal,node.getExp().apply(this, question)); } { List<ACaseAltStmStmIR> copy = new ArrayList<ACaseAltStmStmIR>(node.getCases()); for( ACaseAltStmStmIR e : copy) { if(!_visitedNodes.contains(e)) { mergeReturns(retVal,e.apply(this, question)); } } } if(node.getOthers() != null && !_visitedNodes.contains(node.getOthers())) { mergeReturns(retVal,node.getOthers().apply(this, question)); } mergeReturns(retVal,outACasesStmIR(node, question)); return retVal; }
/** * Called by the {@link ACasesStmIR} node from {@link ACasesStmIR#apply(IAnalysis)}. * @param node the calling {@link ACasesStmIR} node */ public A caseACasesStmIR(ACasesStmIR node) throws AnalysisException { _visitedNodes.add(node); A retVal = createNewReturnValue(node); mergeReturns(retVal,inACasesStmIR(node)); if(node.getExp() != null && !_visitedNodes.contains(node.getExp())) { mergeReturns(retVal,node.getExp().apply(this)); } { List<ACaseAltStmStmIR> copy = new ArrayList<ACaseAltStmStmIR>(node.getCases()); for( ACaseAltStmStmIR e : copy) { if(!_visitedNodes.contains(e)) { mergeReturns(retVal,e.apply(this)); } } } if(node.getOthers() != null && !_visitedNodes.contains(node.getOthers())) { mergeReturns(retVal,node.getOthers().apply(this)); } mergeReturns(retVal,outACasesStmIR(node)); return retVal; }
@Override public SStmIR caseACasesStm(ACasesStm node, IRInfo question) throws AnalysisException { PExp exp = node.getExp(); PStm others = node.getOthers(); LinkedList<ACaseAlternativeStm> cases = node.getCases(); SExpIR expCg = exp.apply(question.getExpVisitor(), question); SStmIR othersCg = others != null ? others.apply(question.getStmVisitor(), question) : null; ACasesStmIR casesStmCg = new ACasesStmIR(); casesStmCg.setExp(expCg); casesStmCg.setOthers(othersCg); question.getStmAssistant().handleAlternativesCasesStm(question, exp, cases, casesStmCg.getCases()); return casesStmCg; }
@Override public void caseACasesStmIR(ACasesStmIR node) throws AnalysisException List<ACaseAltStmStmIR> nodeCases = node.getCases(); SPatternIR firstOriginal = nodeCases.get(0).getPattern().clone();
altStm.setPatternType(altExp.getPatternType().clone()); casesStm.getCases().add(altStm);