9 #include <hilti/ast/builder/type.h> 10 #include <hilti/ast/ctor.h> 11 #include <hilti/ast/expression.h> 12 #include <hilti/ast/types/auto.h> 13 #include <hilti/ast/types/bool.h> 14 #include <hilti/ast/types/map.h> 22 Element(Expression k, Expression v,
Meta m =
Meta()) :
NodeBase(nodes(std::move(k), std::move(v)), std::move(m)) {}
25 const auto& key()
const {
return child<Expression>(0); }
26 const auto& value()
const {
return child<Expression>(1); }
31 bool operator==(
const Element& other)
const {
return key() == other.key() && value() == other.value(); }
40 Map(
const std::vector<map::Element>& e,
const Meta& m =
Meta())
42 Map(
const Type& key,
const Type& value,
const std::vector<map::Element>& e,
const Meta& m =
Meta())
45 const auto& keyType()
const {
46 if (
auto t =
children()[0].tryAs<type::Map>() )
52 const auto& valueType()
const {
53 if (
auto t =
children()[0].tryAs<type::Map>() )
54 return t->valueType();
59 auto value()
const {
return children<map::Element>(1, -1); }
63 void setValue(
const std::vector<map::Element>& elems) {
65 for (
auto&& e : elems )
69 bool operator==(
const Map& other)
const {
70 return keyType() == other.keyType() && valueType() == other.valueType() && value() == other.value();
78 auto isLhs()
const {
return false; }
82 auto isEqual(
const Ctor& other)
const {
return node::isEqual(
this, other); }
auto properties() const
Definition: map.h:84
const auto & type() const
Definition: map.h:74
const Node none
Definition: node.cc:14
const auto & children() const
Definition: node.h:472
bool isConstant() const
Definition: map.h:76
auto isTemporary() const
Definition: map.h:80
auto isEqual(const Ctor &other) const
Definition: map.h:82
auto properties() const
Definition: map.h:29
std::map< std::string, node::detail::PropertyValue > Properties
Definition: node.h:98
auto & meta() const
Definition: node.h:476
auto isLhs() const
Definition: map.h:78