Spicy
member.h
1 // Copyright (c) 2020-2021 by the Zeek Project. See LICENSE for details.
2 
3 #pragma once
4 
5 #include <utility>
6 
7 #include <hilti/ast/expression.h>
8 #include <hilti/ast/id.h>
9 #include <hilti/ast/node-ref.h>
10 #include <hilti/ast/node.h>
11 #include <hilti/ast/types/auto.h>
12 #include <hilti/ast/types/member.h>
13 #include <hilti/base/logger.h>
14 
15 namespace hilti::expression {
16 
19 public:
20  Member(ID id, Meta m = Meta()) : NodeBase({id, Type(type::Member(std::move(id)))}, std::move(m)) {}
21  Member(ID id, Type member_type, Meta m = Meta())
22  : NodeBase({std::move(id), std::move(member_type)}, std::move(m)) {}
23 
24  const auto& id() const { return child<ID>(0); }
25 
26  bool operator==(const Member& other) const { return id() == other.id() && type() == other.type(); }
27 
29  bool isLhs() const { return true; }
31  bool isTemporary() const { return false; }
33  const Type& type() const { return child<Type>(1); }
35  auto isConstant() const { return true; }
37  auto isEqual(const Expression& other) const { return node::isEqual(this, other); }
38 
40  auto properties() const { return node::Properties{}; }
41 };
42 
43 } // namespace hilti::expression
Definition: member.h:18
bool isLhs() const
Definition: member.h:29
auto isConstant() const
Definition: member.h:35
auto isEqual(const Expression &other) const
Definition: member.h:37
Definition: member.h:15
Definition: expression.h:18
Definition: meta.h:19
const Type & type() const
Definition: member.h:33
auto properties() const
Definition: member.h:40
Definition: type.h:160
std::map< std::string, node::detail::PropertyValue > Properties
Definition: node.h:97
bool isTemporary() const
Definition: member.h:31
Definition: id.h:18
Definition: node.h:359
Definition: expression.h:21