unionType.setName(unName);
AST switchTypeNode = unNode.getNextSibling();
unionType.setDiscriminatorType(findDataType(switchTypeNode, unName));
AST caseOrDefaultNode = switchTypeNode.getNextSibling();
while (caseOrDefaultNode != null) {
UnionMember unionMember = new UnionMember();
AST typeNode;
if (IDLTokenTypes.LITERAL_default == caseOrDefaultNode.getType()) {
unionMember.setDefault(true);
typeNode = caseOrDefaultNode.getFirstChild();
} else {
unionMember.setDefault(false);
AST caseValueNode = caseOrDefaultNode.getFirstChild();
unionMember.setDiscriminatorValue(caseValueNode.getText());
typeNode = caseValueNode.getNextSibling();
}
unionMember.setDataType(findDataType(typeNode, unName));
AST memberNode = typeNode.getNextSibling();
unionMember.setName(memberNode.toString());
unionType.addMember(unionMember);
caseOrDefaultNode = caseOrDefaultNode.getNextSibling();
}
return unionType;
}