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 {
12 namespace statement {
13 
15 class Block : public NodeBase, public hilti::trait::isStatement {
16 public:
17  Block(std::vector<Statement> stmts = {}, Meta m = Meta()) : NodeBase(nodes(std::move(stmts)), std::move(m)) {}
18 
19  auto statements() const { return childsOfType<Statement>(); }
20 
21  bool operator==(const Block& /* other */) const {
22  // return statements() == other.statements();
23  return true; // FIXME
24  }
25 
27  void _add(Statement s) { addChild(std::move(s)); }
28 
30  auto& _lastStatementNode() { return childs().back(); }
31 
33  auto isEqual(const Statement& other) const { return node::isEqual(this, other); }
34 
36  auto properties() const { return node::Properties{}; }
37 };
38 
39 } // namespace statement
40 } // namespace hilti
void _add(Statement s)
Definition: block.h:27
void addChild(Node n)
Definition: node.h:459
Definition: meta.h:18
auto & _lastStatementNode()
Definition: block.h:30
Definition: statement.h:14
Definition: block.h:15
std::map< std::string, node::detail::PropertyValue > Properties
Definition: node.h:99
auto isEqual(const Statement &other) const
Definition: block.h:33
const auto & childs() const
Definition: node.h:470
auto properties() const
Definition: block.h:36
Definition: node.h:358