/** * Called by the {@link AMapSeqUpdateStmIR} node from {@link AMapSeqUpdateStmIR#apply(IIsaAnalysis)}. * @param node the calling {@link AMapSeqUpdateStmIR} node */ public void caseAMapSeqUpdateStmIR(AMapSeqUpdateStmIR node) throws AnalysisException { _visitedNodes.add(node); inAMapSeqUpdateStmIR(node); if(node.getCol() != null && !_visitedNodes.contains(node.getCol())) { node.getCol().apply(this); } if(node.getIndex() != null && !_visitedNodes.contains(node.getIndex())) { node.getIndex().apply(this); } if(node.getValue() != null && !_visitedNodes.contains(node.getValue())) { node.getValue().apply(this); } outAMapSeqUpdateStmIR(node); }
/** * Returns a deep clone of this {@link AMapSeqUpdateStmIR} node. * @return a deep clone of this {@link AMapSeqUpdateStmIR} node */ public AMapSeqUpdateStmIR clone() { return new AMapSeqUpdateStmIR( _sourceNode, _tag, _metaData, cloneNode(_col), cloneNode(_index), cloneNode(_value) ); }
/** * Creates a new tree field only constructor {@code AMapSeqUpdateStmIR TAG=mapSeqUpdate} 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 col_ the {@link SExpIR} node for the {@code col} child of this {@link AMapSeqUpdateStmIR} node * @param index_ the {@link SExpIR} node for the {@code index} child of this {@link AMapSeqUpdateStmIR} node * @param value_ the {@link SExpIR} node for the {@code value} child of this {@link AMapSeqUpdateStmIR} node */ public AMapSeqUpdateStmIR(SExpIR col_, SExpIR index_, SExpIR value_) { super(null,null,null); this.setCol(col_); this.setIndex(index_); this.setValue(value_); }
SExpIR value = node.getExp(); AMapSeqUpdateStmIR mapSeqUpd = new AMapSeqUpdateStmIR(); mapSeqUpd.setCol(col); mapSeqUpd.setIndex(index.clone()); mapSeqUpd.setValue(value.clone()); mapSeqUpd.setSourceNode(node.getSourceNode()); mapSeqUpd.setTag(node.getTag());
@Override public void caseAMapSeqUpdateStmIR(AMapSeqUpdateStmIR node) throws AnalysisException { if (node.getCol() instanceof SVarExpIR) { SVarExpIR col = (SVarExpIR) node.getCol(); handleStateUpdate(node, col, stateDesInfo.getStateDesVars(node), null, namedTypeHandler.handleMapSeq(node)); } else { log.error("Expected collection of map/sequence" + " update to be a variable expression by now. Got: " + node.getCol()); } }
/** * Called by the {@link AMapSeqUpdateStmIR} node from {@link AMapSeqUpdateStmIR#apply(IAnalysis)}. * @param node the calling {@link AMapSeqUpdateStmIR} node */ public void caseAMapSeqUpdateStmIR(AMapSeqUpdateStmIR node) throws AnalysisException { _visitedNodes.add(node); inAMapSeqUpdateStmIR(node); if(node.getCol() != null && !_visitedNodes.contains(node.getCol())) { node.getCol().apply(this); } if(node.getIndex() != null && !_visitedNodes.contains(node.getIndex())) { node.getIndex().apply(this); } if(node.getValue() != null && !_visitedNodes.contains(node.getValue())) { node.getValue().apply(this); } outAMapSeqUpdateStmIR(node); }
private boolean cloneNotNeededMapPutGet(SExpIR exp) { INode parent = exp.parent(); if (parent instanceof AMapSeqUpdateStmIR) { AMapSeqUpdateStmIR mapSeqUpd = (AMapSeqUpdateStmIR) parent; if (mapSeqUpd.getCol() == exp) { return true; } } if (parent instanceof AMapSeqGetExpIR) { AMapSeqGetExpIR mapSeqGet = (AMapSeqGetExpIR) parent; if (mapSeqGet.getCol() == exp) { return true; } } return false; }
/** * Creates a new complete constructor {@code AMapSeqUpdateStmIR} 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 col_ the {@link SExpIR} node for the {@code col} child of this {@link AMapSeqUpdateStmIR} node * @param index_ the {@link SExpIR} node for the {@code index} child of this {@link AMapSeqUpdateStmIR} node * @param value_ the {@link SExpIR} node for the {@code value} child of this {@link AMapSeqUpdateStmIR} node */ public AMapSeqUpdateStmIR(SourceNode sourceNode_, Object tag_, List<? extends ClonableString> metaData_, SExpIR col_, SExpIR index_, SExpIR value_) { super(sourceNode_,tag_,metaData_); this.setCol(col_); this.setIndex(index_); this.setValue(value_); }
/** * Creates a deep clone of this {@link AMapSeqUpdateStmIR} 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 AMapSeqUpdateStmIR} node */ public AMapSeqUpdateStmIR clone(Map<INode,INode> oldToNewMap) { AMapSeqUpdateStmIR node = new AMapSeqUpdateStmIR( _sourceNode, _tag, _metaData, cloneNode(_col, oldToNewMap), cloneNode(_index, oldToNewMap), cloneNode(_value, oldToNewMap) ); oldToNewMap.put(this, node); return node; }
/** * Called by the {@link AMapSeqUpdateStmIR} node from {@link AMapSeqUpdateStmIR#apply(IAnalysis)}. * @param node the calling {@link AMapSeqUpdateStmIR} node */ public void caseAMapSeqUpdateStmIR(AMapSeqUpdateStmIR node, Q question) throws AnalysisException { _visitedNodes.add(node); inAMapSeqUpdateStmIR(node, question); if(node.getCol() != null && !_visitedNodes.contains(node.getCol())) { node.getCol().apply(this, question); } if(node.getIndex() != null && !_visitedNodes.contains(node.getIndex())) { node.getIndex().apply(this, question); } if(node.getValue() != null && !_visitedNodes.contains(node.getValue())) { node.getValue().apply(this, question); } outAMapSeqUpdateStmIR(node, question); }
private boolean isColOfMapSeq(AFieldExpIR node) { return node.parent() instanceof AMapSeqGetExpIR && ((AMapSeqGetExpIR) node.parent()).getCol() == node || node.parent() instanceof AMapSeqUpdateStmIR && ((AMapSeqUpdateStmIR) node.parent()).getCol() == node; }
/** * Called by the {@link AMapSeqUpdateStmIR} node from {@link AMapSeqUpdateStmIR#apply(IAnalysis)}. * @param node the calling {@link AMapSeqUpdateStmIR} node */ public A caseAMapSeqUpdateStmIR(AMapSeqUpdateStmIR node, Q question) throws AnalysisException { _visitedNodes.add(node); A retVal = createNewReturnValue(node, question); mergeReturns(retVal,inAMapSeqUpdateStmIR(node, question)); if(node.getCol() != null && !_visitedNodes.contains(node.getCol())) { mergeReturns(retVal,node.getCol().apply(this, question)); } if(node.getIndex() != null && !_visitedNodes.contains(node.getIndex())) { mergeReturns(retVal,node.getIndex().apply(this, question)); } if(node.getValue() != null && !_visitedNodes.contains(node.getValue())) { mergeReturns(retVal,node.getValue().apply(this, question)); } mergeReturns(retVal,outAMapSeqUpdateStmIR(node, question)); return retVal; }
SExpIR col = node.getCol();
/** * Called by the {@link AMapSeqUpdateStmIR} node from {@link AMapSeqUpdateStmIR#apply(IAnalysis)}. * @param node the calling {@link AMapSeqUpdateStmIR} node */ public A caseAMapSeqUpdateStmIR(AMapSeqUpdateStmIR node) throws AnalysisException { _visitedNodes.add(node); A retVal = createNewReturnValue(node); mergeReturns(retVal,inAMapSeqUpdateStmIR(node)); if(node.getCol() != null && !_visitedNodes.contains(node.getCol())) { mergeReturns(retVal,node.getCol().apply(this)); } if(node.getIndex() != null && !_visitedNodes.contains(node.getIndex())) { mergeReturns(retVal,node.getIndex().apply(this)); } if(node.getValue() != null && !_visitedNodes.contains(node.getValue())) { mergeReturns(retVal,node.getValue().apply(this)); } mergeReturns(retVal,outAMapSeqUpdateStmIR(node)); return retVal; }