Spicy
block.h
1 // Copyright (c) 2020-2021 by the Zeek Project. See LICENSE for details.
2 
3 #pragma once
4 
5 #include <utility>
6 #include <vector>
7 
8 #include <hilti/ast/statement.h>
9 #include <hilti/ast/statements/expression.h>
10 
11 namespace hilti::statement {
12 
14 class Block : public NodeBase, public hilti::trait::isStatement {
15 public:
16  Block(std::vector<Statement> stmts = {}, Meta m = Meta()) : NodeBase(nodes(std::move(stmts)), std::move(m)) {}
17 
18  auto statements() const { return childrenOfType<Statement>(); }
19 
20  bool operator==(const Block& /* other */) const {
21  // return statements() == other.statements();
22  return true; // FIXME
23  }
24 
26  void _add(Statement s) { addChild(std::move(s)); }
27 
29  auto& _lastStatementNode() { return children().back(); }
30 
32  auto isEqual(const Statement& other) const { return node::isEqual(this, other); }
33 
35  auto properties() const { return node::Properties{}; }
36 };
37 
38 } // namespace hilti::statement
void _add(Statement s)
Definition: block.h:26
const auto & children() const
Definition: node.h:472
void addChild(Node n)
Definition: node.h:461
Definition: meta.h:19
auto & _lastStatementNode()
Definition: block.h:29
Definition: statement.h:14
Definition: block.h:14
std::map< std::string, node::detail::PropertyValue > Properties
Definition: node.h:98
auto isEqual(const Statement &other) const
Definition: block.h:32
auto properties() const
Definition: block.h:35
Definition: node.h:360