/** * Creates a new tree field only constructor {@code ATryStmIR TAG=try} node with the given nodes as children. * @deprecated This method should not be used, use AstFactory instead. * The basic child nodes are removed from their previous parents. * @param stm_ the {@link SStmIR} node for the {@code stm} child of this {@link ATryStmIR} node * @param catchClauses_ the {@link NodeList} node for the {@code catchClauses} child of this {@link ATryStmIR} node * @param finally_ the {@link SStmIR} node for the {@code finally} child of this {@link ATryStmIR} node */ public ATryStmIR(SStmIR stm_, List<? extends ACatchClauseDeclIR> catchClauses_, SStmIR finally_) { super(null,null,null); this.setStm(stm_); this.setCatchClauses(catchClauses_); this.setFinally(finally_); }
/** * Called by the {@link ATryStmIR} node from {@link ATryStmIR#apply(IAnalysis)}. * @param node the calling {@link ATryStmIR} node */ public void caseATryStmIR(ATryStmIR node) throws AnalysisException { _visitedNodes.add(node); inATryStmIR(node); if(node.getStm() != null && !_visitedNodes.contains(node.getStm())) { node.getStm().apply(this); } { List<ACatchClauseDeclIR> copy = new ArrayList<ACatchClauseDeclIR>(node.getCatchClauses()); for( ACatchClauseDeclIR e : copy) { if(!_visitedNodes.contains(e)) { e.apply(this); } } } if(node.getFinally() != null && !_visitedNodes.contains(node.getFinally())) { node.getFinally().apply(this); } outATryStmIR(node); }
ATryStmIR tryStm = new ATryStmIR(); methodBody.getStatements().add(tryStm); tryStm.setStm(tryBody); tryStm.getCatchClauses().add(consTcFailHandling());
ATryStmIR trystm = new ATryStmIR(); trystm.setStm(methodIR.getBody()); trystm.setFinally(leaving); bodyStm.getStatements().add(trystm);
/** * Called by the {@link ATryStmIR} node from {@link ATryStmIR#apply(IIsaAnalysis)}. * @param node the calling {@link ATryStmIR} node */ public void caseATryStmIR(ATryStmIR node) throws AnalysisException { _visitedNodes.add(node); inATryStmIR(node); if(node.getStm() != null && !_visitedNodes.contains(node.getStm())) { node.getStm().apply(this); } { List<ACatchClauseDeclIR> copy = new ArrayList<ACatchClauseDeclIR>(node.getCatchClauses()); for( ACatchClauseDeclIR e : copy) { if(!_visitedNodes.contains(e)) { e.apply(this); } } } if(node.getFinally() != null && !_visitedNodes.contains(node.getFinally())) { node.getFinally().apply(this); } outATryStmIR(node); }
/** * Called by the {@link ATryStmIR} node from {@link ATryStmIR#apply(IAnalysis)}. * @param node the calling {@link ATryStmIR} node */ public void caseATryStmIR(ATryStmIR node, Q question) throws AnalysisException { _visitedNodes.add(node); inATryStmIR(node, question); if(node.getStm() != null && !_visitedNodes.contains(node.getStm())) { node.getStm().apply(this, question); } { List<ACatchClauseDeclIR> copy = new ArrayList<ACatchClauseDeclIR>(node.getCatchClauses()); for( ACatchClauseDeclIR e : copy) { if(!_visitedNodes.contains(e)) { e.apply(this, question); } } } if(node.getFinally() != null && !_visitedNodes.contains(node.getFinally())) { node.getFinally().apply(this, question); } outATryStmIR(node, question); }
/** * Creates a new complete constructor {@code ATryStmIR} node with the given nodes as children. * @deprecated This method should not be used, use AstFactory instead. * The basic child nodes are removed from their previous parents. * @param stm_ the {@link SStmIR} node for the {@code stm} child of this {@link ATryStmIR} node * @param catchClauses_ the {@link NodeList} node for the {@code catchClauses} child of this {@link ATryStmIR} node * @param finally_ the {@link SStmIR} node for the {@code finally} child of this {@link ATryStmIR} node */ public ATryStmIR(SourceNode sourceNode_, Object tag_, List<? extends ClonableString> metaData_, SStmIR stm_, List<? extends ACatchClauseDeclIR> catchClauses_, SStmIR finally_) { super(sourceNode_,tag_,metaData_); this.setStm(stm_); this.setCatchClauses(catchClauses_); this.setFinally(finally_); }
/** * Creates a deep clone of this {@link ATryStmIR} 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 ATryStmIR} node */ public ATryStmIR clone(Map<INode,INode> oldToNewMap) { ATryStmIR node = new ATryStmIR( _sourceNode, _tag, _metaData, cloneNode(_stm, oldToNewMap), cloneList(_catchClauses, oldToNewMap), cloneNode(_finally, oldToNewMap) ); oldToNewMap.put(this, node); return node; }
/** * Called by the {@link ATryStmIR} node from {@link ATryStmIR#apply(IAnalysis)}. * @param node the calling {@link ATryStmIR} node */ public A caseATryStmIR(ATryStmIR node) throws AnalysisException { _visitedNodes.add(node); A retVal = createNewReturnValue(node); mergeReturns(retVal,inATryStmIR(node)); if(node.getStm() != null && !_visitedNodes.contains(node.getStm())) { mergeReturns(retVal,node.getStm().apply(this)); } { List<ACatchClauseDeclIR> copy = new ArrayList<ACatchClauseDeclIR>(node.getCatchClauses()); for( ACatchClauseDeclIR e : copy) { if(!_visitedNodes.contains(e)) { mergeReturns(retVal,e.apply(this)); } } } if(node.getFinally() != null && !_visitedNodes.contains(node.getFinally())) { mergeReturns(retVal,node.getFinally().apply(this)); } mergeReturns(retVal,outATryStmIR(node)); return retVal; }
/** * Called by the {@link ATryStmIR} node from {@link ATryStmIR#apply(IAnalysis)}. * @param node the calling {@link ATryStmIR} node */ public A caseATryStmIR(ATryStmIR node, Q question) throws AnalysisException { _visitedNodes.add(node); A retVal = createNewReturnValue(node, question); mergeReturns(retVal,inATryStmIR(node, question)); if(node.getStm() != null && !_visitedNodes.contains(node.getStm())) { mergeReturns(retVal,node.getStm().apply(this, question)); } { List<ACatchClauseDeclIR> copy = new ArrayList<ACatchClauseDeclIR>(node.getCatchClauses()); for( ACatchClauseDeclIR e : copy) { if(!_visitedNodes.contains(e)) { mergeReturns(retVal,e.apply(this, question)); } } } if(node.getFinally() != null && !_visitedNodes.contains(node.getFinally())) { mergeReturns(retVal,node.getFinally().apply(this, question)); } mergeReturns(retVal,outATryStmIR(node, question)); return retVal; }