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 {
11 namespace expression {
12 
14 class LogicalNot : public NodeBase, public trait::isExpression {
15 public:
16  LogicalNot(Expression e, Meta m = Meta()) : NodeBase(nodes(std::move(e), type::Bool(m)), m) {}
17 
18  const auto& expression() const { return child<Expression>(0); }
19 
20  void setExpression(const Expression op) { children()[0] = std::move(op); }
21 
22  bool operator==(const LogicalNot& other) const { return expression() == other.expression(); }
23 
25  bool isLhs() const { return false; }
27  bool isTemporary() const { return true; }
29  const auto& type() const { return child<Type>(1); }
31  auto isConstant() const { return expression().isConstant(); }
33  auto isEqual(const Expression& other) const { return node::isEqual(this, other); }
34 
36  auto properties() const { return node::Properties{}; }
37 };
38 
39 } // namespace expression
40 } // namespace hilti
Definition: logical-not.h:14
bool isLhs() const
Definition: logical-not.h:25
const auto & children() const
Definition: node.h:470
auto isEqual(const Expression &other) const
Definition: logical-not.h:33
Definition: expression.h:17
auto isConstant() const
Definition: logical-not.h:31
Definition: meta.h:18
auto properties() const
Definition: logical-not.h:36
std::map< std::string, node::detail::PropertyValue > Properties
Definition: node.h:99
Definition: bool.h:13
const auto & type() const
Definition: logical-not.h:29
bool isTemporary() const
Definition: logical-not.h:27
Definition: node.h:358