Spicy
hilti
toolchain
include
ast
statements
break.h
1
// Copyright (c) 2020-now by the Zeek Project. See LICENSE for details.
2
3
#pragma once
4
5
#include <utility>
6
7
#include <hilti/ast/statement.h>
8
9
namespace
hilti::statement {
10
12
class
Break
:
public
Statement
{
13
public
:
18
Statement
*
linkedLoop
()
const
{
return
_loop; }
19
27
void
setLinkedLoop
(
Statement
* loop) { _loop = loop; }
28
29
node::Properties
properties
() const final {
30
node::Properties
properties
;
31
32
if
( _loop )
33
properties
= {{
"loop"
, util::fmt(
"%p"
, _loop->
identity
())}};
34
35
return
std::move(
properties
) +
Statement::properties
();
36
}
37
38
static
auto
create(
ASTContext
* ctx,
Meta
meta
= {}) {
return
ctx->
make
<Break>(ctx, {}, std::move(
meta
)); }
39
40
protected
:
41
Break(ASTContext* ctx, Nodes
children
, Meta
meta
)
42
: Statement(ctx, NodeTags, std::move(
children
), std::move(
meta
)) {}
43
44
HILTI_NODE_1(statement::Break, Statement,
final
);
45
46
private
:
47
Statement* _loop =
nullptr
;
48
};
49
50
}
// namespace hilti::statement
hilti::ASTContext
Definition:
ast-context.h:128
hilti::ASTContext::make
T * make(Args &&... args)
Definition:
ast-context.h:382
hilti::Meta
Definition:
meta.h:30
hilti::Node::children
const auto & children() const
Definition:
node.h:382
hilti::Node::identity
uint64_t identity() const
Definition:
node.h:379
hilti::Node::meta
const auto & meta() const
Definition:
node.h:324
hilti::Node::properties
virtual node::Properties properties() const
Definition:
node.h:953
hilti::Statement
Definition:
statement.h:15
hilti::statement::Break
Definition:
break.h:12
hilti::statement::Break::linkedLoop
Statement * linkedLoop() const
Definition:
break.h:18
hilti::statement::Break::properties
node::Properties properties() const final
Definition:
break.h:29
hilti::statement::Break::setLinkedLoop
void setLinkedLoop(Statement *loop)
Definition:
break.h:27
Generated by
1.9.1