7 #include <hilti/ast/attribute.h> 9 #include <spicy/ast/aliases.h> 10 #include <spicy/ast/types/unit-item.h> 11 #include <spicy/ast/types/unit.h> 18 Property(
ID id, std::optional<AttributeSet> attrs = {},
bool inherited =
false,
Meta m =
Meta())
19 :
NodeBase(nodes(std::move(
id), node::none, std::move(attrs)), std::move(m)), _inherited(inherited) {}
21 Property(
ID id, Expression expr, std::optional<AttributeSet> attrs = {},
bool inherited =
false,
Meta m =
Meta())
22 :
NodeBase(nodes(std::move(
id), std::move(expr), std::move(attrs)), std::move(m)), _inherited(inherited) {}
24 const auto& id()
const {
return child<ID>(0); }
25 auto expression()
const {
return children()[1].tryAs<Expression>(); }
27 bool inherited()
const {
return _inherited; }
29 bool operator==(
const Property& other)
const {
30 return id() == other.id() && expression() == other.expression() && attributes() == other.attributes();
34 const Type& itemType()
const {
return type::void_; }
35 bool isResolved()
const {
return type::isResolved(itemType()); }
36 auto isEqual(
const Item& other)
const {
return node::isEqual(
this, other); }
39 auto properties()
const {
return node::Properties{{
"inherited", _inherited}}; }
NodeBase(Meta meta)
Definition: node.h:366
const auto & children() const
Definition: node.h:471
Definition: property.h:16
Definition: attribute.h:145
Definition: unit-item.h:19