Spicy
exception.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/ctor.h>
8 #include <hilti/ast/expression.h>
9 #include <hilti/ast/types/exception.h>
10 
11 namespace hilti {
12 namespace ctor {
13 
15 class Exception : public NodeBase, public hilti::trait::isCtor {
16 public:
17  Exception(Type t, Expression msg, Meta m = Meta()) : NodeBase({std::move(t), std::move(msg)}, std::move(m)) {}
18 
19  const auto& value() const { return child<Expression>(1); }
20 
21  bool operator==(const Exception& other) const { return type() == other.type() && value() == other.value(); }
22 
24  const Type& type() const { return child<Type>(0); }
26  bool isConstant() const { return true; }
28  auto isLhs() const { return false; }
30  auto isTemporary() const { return true; }
32  auto isEqual(const Ctor& other) const { return node::isEqual(this, other); }
33 
35  auto properties() const { return node::Properties{}; }
36 };
37 
38 } // namespace ctor
39 } // namespace hilti
auto isTemporary() const
Definition: exception.h:30
Definition: meta.h:18
Definition: type.h:159
Definition: exception.h:15
auto isLhs() const
Definition: exception.h:28
std::map< std::string, node::detail::PropertyValue > Properties
Definition: node.h:99
auto properties() const
Definition: exception.h:35
const Type & type() const
Definition: exception.h:24
Definition: ctor.h:15
auto isEqual(const Ctor &other) const
Definition: exception.h:32
bool isConstant() const
Definition: exception.h:26
Definition: node.h:358