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> 23 Element(Expression k, Expression v,
Meta m =
Meta()) :
NodeBase(nodes(std::move(k), std::move(v)), std::move(m)) {}
26 const auto& key()
const {
return child<Expression>(0); }
27 const auto& value()
const {
return child<Expression>(1); }
32 bool operator==(
const Element& other)
const {
return key() == other.key() && value() == other.value(); }
41 Map(
const std::vector<map::Element>& e,
const Meta& m =
Meta())
46 const auto& keyType()
const {
47 if (
auto t =
children()[0].tryAs<type::Map>() )
53 const auto& valueType()
const {
54 if (
auto t =
children()[0].tryAs<type::Map>() )
55 return t->valueType();
60 auto value()
const {
return children<const map::Element>(1, -1); }
64 void setValue(std::vector<map::Element> elems) {
66 for (
auto&& e : elems )
70 bool operator==(
const Map& other)
const {
71 return keyType() == other.keyType() && valueType() == other.valueType() && value() == other.value();
79 auto isLhs()
const {
return false; }
83 auto isEqual(
const Ctor& other)
const {
return node::isEqual(
this, other); }
auto properties() const
Definition: map.h:85
const auto & type() const
Definition: map.h:75
const Node none
Definition: node.cc:14
const auto & children() const
Definition: node.h:470
bool isConstant() const
Definition: map.h:77
auto isTemporary() const
Definition: map.h:81
auto isEqual(const Ctor &other) const
Definition: map.h:83
auto properties() const
Definition: map.h:30
std::map< std::string, node::detail::PropertyValue > Properties
Definition: node.h:99
auto & meta() const
Definition: node.h:474
auto isLhs() const
Definition: map.h:79