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> 31 :
NodeBase(nodes(other.id()), other.
meta()), _etype(std::move(enum_type)), _value(other._value) {}
33 const ID& id()
const {
return child<ID>(0); }
34 const auto& enumType()
const {
return _etype ? _etype->as<
Type>() : type::auto_; }
35 auto value()
const {
return _value; }
37 bool operator==(
const Label& other)
const {
return id() == other.id() && value() == other.value(); }
55 :
TypeBase(nodes(_normalizeLabels(std::move(l))), std::move(m)) {}
58 std::vector<std::reference_wrapper<const enum_::Label>> labels()
const;
64 std::vector<std::reference_wrapper<const enum_::Label>> uniqueLabels()
const;
67 for (
const auto& l : labels() ) {
68 if ( l.get().id() == id )
75 auto labelDeclarationRefs() {
return childRefs(0, -1); }
77 bool operator==(
const Enum& other)
const {
return childs<Declaration>(0, -1) == other.
childs<
Declaration>(0, -1); }
80 auto isEqual(
const Type& other)
const {
return node::isEqual(
this, other); }
82 auto _isResolved(ResolvedState* rstate)
const {
return _initialized; }
85 std::vector<Node> params;
86 for (
auto&& c : uniqueLabels() )
87 params.emplace_back(c.get());
98 static void initLabelTypes(
Node* n);
101 static std::vector<Declaration> _normalizeLabels(std::vector<enum_::Label> labels);
103 bool _wildcard =
false;
104 bool _initialized =
false;
Definition: declaration.h:53
auto childRefs(int begin, int end)
Definition: node.h:426
auto isEqual(const Type &other) const
Definition: enum.h:80
auto _isResolved(ResolvedState *rstate) const
Definition: enum.h:82
Definition: optional-ref.h:22
auto childs(int begin, int end) const
Definition: node.h:413
auto properties() const
Definition: enum.h:95
auto typeParameters() const
Definition: enum.h:84
auto properties() const
Definition: enum.h:40
Definition: type_erase.h:30
std::map< std::string, node::detail::PropertyValue > Properties
Definition: node.h:99
Definition: node-ref.h:44
auto & meta() const
Definition: node.h:474
uint64_t rid() const
Definition: node-ref.h:60
auto isWildcard() const
Definition: enum.h:92