souffle  2.0.2-371-g6315b36
Public Member Functions | Protected Member Functions | Private Attributes
souffle::ast::UnionType Class Reference

The union type class. More...

#include <UnionType.h>

Inheritance diagram for souffle::ast::UnionType:
Inheritance graph
Collaboration diagram for souffle::ast::UnionType:
Collaboration graph

Public Member Functions

void add (QualifiedName type)
 Add another unioned type. More...
 
UnionTypeclone () const override
 
const std::vector< QualifiedName > & getTypes () const
 Return list of unioned types. More...
 
void setType (size_t idx, QualifiedName type)
 Set type. More...
 
 UnionType (QualifiedName name, std::vector< QualifiedName > types, SrcLocation loc={})
 
- Public Member Functions inherited from souffle::ast::analysis::Type
const QualifiedNamegetName () const
 
const TypeEnvironmentgetTypeEnvironment () const
 
bool operator!= (const Type &other) const
 
bool operator< (const Type &other) const
 
bool operator== (const Type &other) const
 
 Type (const Type &other)=delete
 
virtual ~Type ()=default
 

Protected Member Functions

bool equal (const Node &node) const override
 
void print (std::ostream &os) const override
 
- Protected Member Functions inherited from souffle::ast::analysis::Type
 Type (const TypeEnvironment &environment, QualifiedName name)
 

Private Attributes

std::vector< QualifiedNametypes
 List of unioned types. More...
 

Additional Inherited Members

- Protected Attributes inherited from souffle::ast::analysis::Type
const TypeEnvironmentenvironment
 A reference to the type environment this type is associated to. More...
 
QualifiedName name
 

Detailed Description

The union type class.

Example: .type A = B1 | B2 | ... | Bk

A union type combines multiple types into a new super type. Each of the enumerated types become a sub-type of the new union type.

Definition at line 50 of file UnionType.h.

Constructor & Destructor Documentation

◆ UnionType()

souffle::ast::UnionType::UnionType ( QualifiedName  name,
std::vector< QualifiedName types,
SrcLocation  loc = {} 
)
inline

Definition at line 52 of file UnionType.h.

55  {

Member Function Documentation

◆ add()

void souffle::ast::UnionType::add ( QualifiedName  type)
inline

Add another unioned type.

Definition at line 61 of file UnionType.h.

64  {

◆ clone()

UnionType* souffle::ast::UnionType::clone ( ) const
inlineoverride

Definition at line 70 of file UnionType.h.

73  {

◆ equal()

bool souffle::ast::UnionType::equal ( const Node node) const
inlineoverrideprotected

Definition at line 79 of file UnionType.h.

◆ getTypes()

const std::vector<QualifiedName>& souffle::ast::UnionType::getTypes ( ) const
inline

Return list of unioned types.

Definition at line 56 of file UnionType.h.

60  {

◆ print()

void souffle::ast::UnionType::print ( std::ostream &  os) const
inlineoverrideprotectedvirtual

Reimplemented from souffle::ast::analysis::Type.

Definition at line 75 of file UnionType.h.

78  :
79  /** List of unioned types */

◆ setType()

void souffle::ast::UnionType::setType ( size_t  idx,
QualifiedName  type 
)
inline

Set type.

Definition at line 66 of file UnionType.h.

68  :
69  void print(std::ostream& os) const override {

Field Documentation

◆ types

std::vector<QualifiedName> souffle::ast::UnionType::types
private

List of unioned types.

Definition at line 86 of file UnionType.h.


The documentation for this class was generated from the following file:
souffle::ast::analysis::UnionType::print
void print(std::ostream &out) const override
Definition: TypeSystem.cpp:38