Spicy
throw.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/statement.h>
9 
10 namespace hilti {
11 namespace statement {
12 
14 class Throw : public NodeBase, public hilti::trait::isStatement {
15 public:
16  Throw(Meta m = Meta()) : NodeBase({node::none}, std::move(m)) {}
17  Throw(hilti::Expression excpt, Meta m = Meta()) : NodeBase({std::move(excpt)}, std::move(m)) {}
18 
19  auto expression() const { return childs()[0].tryAs<hilti::Expression>(); }
20 
21  bool operator==(const Throw& other) const { return expression() == other.expression(); }
22 
24  auto isEqual(const Statement& other) const { return node::isEqual(this, other); }
25 
27  auto properties() const { return node::Properties{}; }
28 };
29 
30 } // namespace statement
31 } // namespace hilti
Definition: throw.h:14
auto isEqual(const Statement &other) const
Definition: throw.h:24
const Node none
Definition: node.cc:14
auto properties() const
Definition: throw.h:27
Definition: meta.h:18
Definition: statement.h:14
std::map< std::string, node::detail::PropertyValue > Properties
Definition: node.h:99
const auto & childs() const
Definition: node.h:470
Definition: node.h:358