10 #include <hilti/ast/declaration.h> 11 #include <hilti/ast/declarations/constant.h> 12 #include <hilti/ast/id.h> 13 #include <hilti/ast/type.h> 14 #include <hilti/ast/types/auto.h> 15 #include <hilti/ast/types/bool.h> 16 #include <hilti/ast/types/unknown.h> 30 :
NodeBase(nodes(other.id()), other.
meta()), _etype(std::move(enum_type)), _value(other._value) {}
32 const ID& id()
const {
return child<ID>(0); }
33 const auto& enumType()
const {
return _etype ? _etype->as<
Type>() : type::auto_; }
34 auto value()
const {
return _value; }
36 bool operator==(
const Label& other)
const {
return id() == other.id() && value() == other.value(); }
54 :
TypeBase(nodes(_normalizeLabels(std::move(l))), std::move(m)) {}
57 std::vector<std::reference_wrapper<const enum_::Label>> labels()
const;
63 std::vector<std::reference_wrapper<const enum_::Label>> uniqueLabels()
const;
66 for (
const auto& l : labels() ) {
67 if ( l.get().id() == id )
74 auto labelDeclarationRefs() {
return childRefs(0, -1); }
76 bool operator==(
const Enum& other)
const {
81 auto isEqual(
const Type& other)
const {
return node::isEqual(
this, other); }
83 auto _isResolved(ResolvedState* rstate)
const {
return _initialized; }
86 std::vector<Node> params;
87 for (
auto&& c : uniqueLabels() )
88 params.emplace_back(c.get());
99 static void initLabelTypes(
Node* n);
102 static std::vector<Declaration> _normalizeLabels(std::vector<enum_::Label> labels);
104 bool _wildcard =
false;
105 bool _initialized =
false;
Definition: declaration.h:53
auto childRefs(int begin, int end)
Definition: node.h:427
auto isEqual(const Type &other) const
Definition: enum.h:81
auto _isResolved(ResolvedState *rstate) const
Definition: enum.h:83
Definition: optional-ref.h:22
auto properties() const
Definition: enum.h:96
auto typeParameters() const
Definition: enum.h:85
auto properties() const
Definition: enum.h:39
auto children(int begin, int end) const
Definition: node.h:414
Definition: type_erase.h:30
std::map< std::string, node::detail::PropertyValue > Properties
Definition: node.h:97
Definition: node-ref.h:45
auto & meta() const
Definition: node.h:475
uint64_t rid() const
Definition: node-ref.h:61
auto isWildcard() const
Definition: enum.h:93