8 #include <hilti/ast/attribute.h> 9 #include <hilti/ast/expression.h> 10 #include <hilti/ast/function.h> 11 #include <hilti/ast/id.h> 12 #include <hilti/ast/type.h> 13 #include <hilti/ast/types/function.h> 14 #include <hilti/ast/types/unknown.h> 24 Field(
ID id, Type t, std::optional<AttributeSet> attrs = {},
Meta m =
Meta())
25 :
NodeBase(nodes(std::move(
id), std::move(t), std::move(attrs)), std::move(m)) {}
27 const auto& id()
const {
return child<ID>(0); }
28 auto type()
const {
return type::effectiveType(child<Type>(1)); }
34 bool operator==(
const Field& other)
const {
35 return id() == other.id() && type() == other.type() && attributes() == other.attributes();
47 x.childs()[2] = attrs;
63 auto fields()
const {
return childsOfType<union_::Field>(); }
66 std::vector<Type> types;
67 for (
auto c = ++
childs().begin(); c !=
childs().end(); c++ )
75 for (
auto c = ++
childs().begin(); c !=
childs().end(); c++ )
81 std::optional<union_::Field> field(
const ID&
id)
const {
82 for (
auto f : fields() ) {
90 unsigned int index(
const ID&
id)
const {
99 auto fields(
const ID&
id)
const {
100 std::vector<union_::Field> x;
102 for (
const auto& f : fields() ) {
110 bool operator==(
const Union& other)
const {
111 if ( typeID() && other.
typeID() )
112 return *typeID() == *other.
typeID();
114 return fields() == other.fields();
118 auto isEqual(
const Type& other)
const {
return node::isEqual(
this, other); }
121 std::vector<Node> params;
122 for (
auto c = ++
childs().begin(); c !=
childs().end(); c++ )
140 auto x = Type(s)._clone().as<
Union>();
146 bool _wildcard =
false;
static Union addField(const Union &s, union_::Field f)
Definition: union.h:139
auto & childs() const
Definition: node.h:445
static Field setAttributes(const Field &f, const AttributeSet &attrs)
Definition: union.h:45
const Node none
Definition: node.cc:12
constexpr auto enumerate(T &&iterable)
Definition: util.h:153
void addChild(Node n)
Definition: node.h:434
Definition: attribute.h:159
auto properties() const
Definition: union.h:130
auto typeParameters() const
Definition: union.h:120
auto properties() const
Definition: union.h:32
auto isWildcard() const
Definition: union.h:127
std::map< std::string, node::detail::PropertyValue > Properties
Definition: node.h:83
std::optional< ID > typeID() const
Definition: type.h:163
auto isEqual(const Type &other) const
Definition: union.h:118