@Override protected SExpIR getEmptyCollection() { return new AEnumSeqExpIR(); }
/** * 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; }
/** * 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) ); }
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 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; }
AEnumSeqExpIR emptySeq = new AEnumSeqExpIR(); emptySeq.setType(type.clone());