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::statement {
11 
13 class Throw : public NodeBase, public hilti::trait::isStatement {
14 public:
15  Throw(Meta m = Meta()) : NodeBase({node::none}, std::move(m)) {}
16  Throw(hilti::Expression excpt, Meta m = Meta()) : NodeBase({std::move(excpt)}, std::move(m)) {}
17 
18  auto expression() const { return children()[0].tryAs<hilti::Expression>(); }
19 
20  bool operator==(const Throw& other) const { return expression() == other.expression(); }
21 
23  auto isEqual(const Statement& other) const { return node::isEqual(this, other); }
24 
26  auto properties() const { return node::Properties{}; }
27 };
28 
29 } // namespace hilti::statement
Definition: throw.h:13
auto isEqual(const Statement &other) const
Definition: throw.h:23
const Node none
Definition: node.cc:14
const auto & children() const
Definition: node.h:472
auto properties() const
Definition: throw.h:26
Definition: meta.h:19
Definition: statement.h:14
std::map< std::string, node::detail::PropertyValue > Properties
Definition: node.h:98
Definition: node.h:360