/** * Creates a new tree field only constructor {@code AUnionTypeIR TAG=union} 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 types_ the {@link NodeList} node for the {@code types} child of this {@link AUnionTypeIR} node */ public AUnionTypeIR(Boolean optional_, ANamedTypeDeclIR namedInvType_, List<? extends STypeIR> types_) { super(null,null,null,optional_,namedInvType_); this.setTypes(types_); }
/** * Creates a new complete constructor {@code AUnionTypeIR} 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 types_ the {@link NodeList} node for the {@code types} child of this {@link AUnionTypeIR} node */ public AUnionTypeIR(SourceNode sourceNode_, Object tag_, List<? extends ClonableString> metaData_, Boolean optional_, ANamedTypeDeclIR namedInvType_, List<? extends STypeIR> types_) { super(sourceNode_,tag_,metaData_,optional_,namedInvType_); this.setTypes(types_); }
public SSeqTypeIR getSeqType(AUnionTypeIR unionType) { AUnionTypeIR seqOf = new AUnionTypeIR(); seqOf.setTypes(findElementTypes(unionType, new CollectionTypeStrategy() { @Override public boolean isCollectionType(STypeIR type) { return type instanceof SSeqTypeIR; } @Override public STypeIR getElementType(STypeIR type) { return ((SSeqTypeIR) type).getSeqOf(); } })); ASeqSeqTypeIR seqType = new ASeqSeqTypeIR(); seqType.setEmpty(false); seqType.setSeqOf(seqOf); return seqType; }
public SSetTypeIR getSetType(AUnionTypeIR unionType) { AUnionTypeIR setOf = new AUnionTypeIR(); setOf.setTypes(findElementTypes(unionType, new CollectionTypeStrategy() { @Override public boolean isCollectionType(STypeIR type) { return type instanceof SSetTypeIR; } @Override public STypeIR getElementType(STypeIR type) { return ((SSetTypeIR) type).getSetOf(); } })); ASetSetTypeIR setType = new ASetSetTypeIR(); setType.setEmpty(false); setType.setSetOf(setOf); return setType; }
unionTypes.setTypes(fieldTypes);