Spicy
logical-not.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/types/bool.h>
9 
10 namespace hilti::expression {
11 
13 class LogicalNot : public NodeBase, public trait::isExpression {
14 public:
15  LogicalNot(Expression e, const Meta& m = Meta()) : NodeBase(nodes(std::move(e), type::Bool(m)), m) {}
16 
17  const auto& expression() const { return child<Expression>(0); }
18 
19  void setExpression(const Expression& op) { children()[0] = op; }
20 
21  bool operator==(const LogicalNot& other) const { return expression() == other.expression(); }
22 
24  bool isLhs() const { return false; }
26  bool isTemporary() const { return true; }
28  const auto& type() const { return child<Type>(1); }
30  auto isConstant() const { return expression().isConstant(); }
32  auto isEqual(const Expression& other) const { return node::isEqual(this, other); }
33 
35  auto properties() const { return node::Properties{}; }
36 };
37 
38 } // namespace hilti::expression
Definition: logical-not.h:13
bool isLhs() const
Definition: logical-not.h:24
const auto & children() const
Definition: node.h:472
auto isEqual(const Expression &other) const
Definition: logical-not.h:32
Definition: expression.h:18
auto isConstant() const
Definition: logical-not.h:30
Definition: meta.h:19
auto properties() const
Definition: logical-not.h:35
std::map< std::string, node::detail::PropertyValue > Properties
Definition: node.h:98
Definition: bool.h:12
const auto & type() const
Definition: logical-not.h:28
bool isTemporary() const
Definition: logical-not.h:26
Definition: node.h:360
Definition: expression.h:21