/** * Returns a deep clone of this {@link AEnumSeqExpIR} node. * @return a deep clone of this {@link AEnumSeqExpIR} node */ public AEnumSeqExpIR clone() { return new AEnumSeqExpIR( _sourceNode, _tag, _metaData, cloneNode(_type), cloneList(_members) ); }
/** * Creates a new complete constructor {@code AEnumSeqExpIR} 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 members_ the {@link NodeList} node for the {@code members} child of this {@link AEnumSeqExpIR} node */ public AEnumSeqExpIR(SourceNode sourceNode_, Object tag_, List<? extends ClonableString> metaData_, STypeIR type_, List<? extends SExpIR> members_) { super(sourceNode_,tag_,metaData_,type_); this.setMembers(members_); }
/** * Called by the {@link AEnumSeqExpIR} node from {@link AEnumSeqExpIR#apply(IIsaAnalysis)}. * @param node the calling {@link AEnumSeqExpIR} node */ public void caseAEnumSeqExpIR(AEnumSeqExpIR node) throws AnalysisException { _visitedNodes.add(node); inAEnumSeqExpIR(node); if(node.getType() != null && !_visitedNodes.contains(node.getType())) { node.getType().apply(this); } { List<SExpIR> copy = new ArrayList<SExpIR>(node.getMembers()); for( SExpIR e : copy) { if(!_visitedNodes.contains(e)) { e.apply(this); } } } outAEnumSeqExpIR(node); }
public SExpIR consCharSequence(STypeIR seqType, String value) { AEnumSeqExpIR enumSeq = new AEnumSeqExpIR(); enumSeq.setType(seqType); for (int i = 0; i < value.length(); i++) { char currentChar = value.charAt(i); ACharLiteralExpIR charLit = new ACharLiteralExpIR(); charLit.setType(new ACharBasicTypeIR()); charLit.setValue(currentChar); enumSeq.getMembers().add(charLit); } return enumSeq; }
@Override public Boolean caseAEnumSeqExpIR(AEnumSeqExpIR node) throws AnalysisException { for (SExpIR m : node.getMembers()) { if (!m.apply(this)) { return false; } } return true; }
AEnumSeqExpIR emptySeq = new AEnumSeqExpIR(); emptySeq.setType(type.clone());
@Override protected SExpIR getEmptyCollection() { return new AEnumSeqExpIR(); }
/** * Called by the {@link AEnumSeqExpIR} node from {@link AEnumSeqExpIR#apply(IAnalysis)}. * @param node the calling {@link AEnumSeqExpIR} node */ public void caseAEnumSeqExpIR(AEnumSeqExpIR node, Q question) throws AnalysisException { _visitedNodes.add(node); inAEnumSeqExpIR(node, question); if(node.getType() != null && !_visitedNodes.contains(node.getType())) { node.getType().apply(this, question); } { List<SExpIR> copy = new ArrayList<SExpIR>(node.getMembers()); for( SExpIR e : copy) { if(!_visitedNodes.contains(e)) { e.apply(this, question); } } } outAEnumSeqExpIR(node, question); }
@Override public SExpIR caseASeqEnumSeqExp(ASeqEnumSeqExp node, IRInfo question) throws AnalysisException { PType type = node.getType(); AEnumSeqExpIR enumSeq = new AEnumSeqExpIR(); if (type instanceof SSeqType) { STypeIR typeCg = type.apply(question.getTypeVisitor(), question); enumSeq.setType(typeCg); } else { question.addUnsupportedNode(node, "Unexpected sequence type for sequence enumeration expression: " + type.getClass().getName()); return null; } LinkedList<PExp> members = node.getMembers(); for (PExp member : members) { SExpIR memberCg = member.apply(question.getExpVisitor(), question); if (memberCg != null) { enumSeq.getMembers().add(memberCg); } else { return null; } } return enumSeq; }
/** * Called by the {@link AEnumSeqExpIR} node from {@link AEnumSeqExpIR#apply(IAnalysis)}. * @param node the calling {@link AEnumSeqExpIR} node */ public void caseAEnumSeqExpIR(AEnumSeqExpIR node) throws AnalysisException { _visitedNodes.add(node); inAEnumSeqExpIR(node); if(node.getType() != null && !_visitedNodes.contains(node.getType())) { node.getType().apply(this); } { List<SExpIR> copy = new ArrayList<SExpIR>(node.getMembers()); for( SExpIR e : copy) { if(!_visitedNodes.contains(e)) { e.apply(this); } } } outAEnumSeqExpIR(node); }
/** * Creates a deep clone of this {@link AEnumSeqExpIR} 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 AEnumSeqExpIR} node */ public AEnumSeqExpIR clone(Map<INode,INode> oldToNewMap) { AEnumSeqExpIR node = new AEnumSeqExpIR( _sourceNode, _tag, _metaData, cloneNode(_type, oldToNewMap), cloneList(_members, oldToNewMap) ); oldToNewMap.put(this, node); return node; }
/** * Creates a new tree field only constructor {@code AEnumSeqExpIR TAG=enum} 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 members_ the {@link NodeList} node for the {@code members} child of this {@link AEnumSeqExpIR} node */ public AEnumSeqExpIR(STypeIR type_, List<? extends SExpIR> members_) { super(null,null,null,type_); this.setMembers(members_); }
/** * Called by the {@link AEnumSeqExpIR} node from {@link AEnumSeqExpIR#apply(IAnalysis)}. * @param node the calling {@link AEnumSeqExpIR} node */ public A caseAEnumSeqExpIR(AEnumSeqExpIR node, Q question) throws AnalysisException { _visitedNodes.add(node); A retVal = createNewReturnValue(node, question); mergeReturns(retVal,inAEnumSeqExpIR(node, question)); if(node.getType() != null && !_visitedNodes.contains(node.getType())) { mergeReturns(retVal,node.getType().apply(this, question)); } { List<SExpIR> copy = new ArrayList<SExpIR>(node.getMembers()); for( SExpIR e : copy) { if(!_visitedNodes.contains(e)) { mergeReturns(retVal,e.apply(this, question)); } } } mergeReturns(retVal,outAEnumSeqExpIR(node, question)); return retVal; }
/** * Called by the {@link AEnumSeqExpIR} node from {@link AEnumSeqExpIR#apply(IAnalysis)}. * @param node the calling {@link AEnumSeqExpIR} node */ public A caseAEnumSeqExpIR(AEnumSeqExpIR node) throws AnalysisException { _visitedNodes.add(node); A retVal = createNewReturnValue(node); mergeReturns(retVal,inAEnumSeqExpIR(node)); if(node.getType() != null && !_visitedNodes.contains(node.getType())) { mergeReturns(retVal,node.getType().apply(this)); } { List<SExpIR> copy = new ArrayList<SExpIR>(node.getMembers()); for( SExpIR e : copy) { if(!_visitedNodes.contains(e)) { mergeReturns(retVal,e.apply(this)); } } } mergeReturns(retVal,outAEnumSeqExpIR(node)); return retVal; }