7 #include <hilti/ast/expression.h>
8 #include <hilti/ast/statement.h>
9 #include <hilti/ast/type.h>
11 namespace hilti::statement {
24 auto expression()
const {
return child<::hilti::Expression>(0); }
25 auto exception()
const {
return child<UnqualifiedType>(1); }
26 auto message()
const {
return child<::hilti::Expression>(2); }
27 bool expectException()
const {
return _expect_exception; }
30 auto p = node::Properties{{
"expect_exception", _expect_exception}};
44 return ctx->
make<
Assert>(ctx, {expr,
nullptr, msg},
false, std::move(
meta));
59 return ctx->
make<
Assert>(ctx, {expr, excpt, msg},
true, std::move(
meta));
63 Assert(ASTContext* ctx, Nodes
children,
bool expect_exception, Meta
meta)
64 : Statement(ctx, NodeTags, std::move(
children), std::move(
meta)), _expect_exception(expect_exception) {}
66 HILTI_NODE_1(statement::Assert, Statement,
final);
69 bool _expect_exception;
Definition: ast-context.h:121
T * make(Args &&... args)
Definition: ast-context.h:366
Definition: expression.h:15
void setChild(ASTContext *ctx, size_t idx, Node *n)
Definition: node.h:602
const auto & children() const
Definition: node.h:364
const auto & meta() const
Definition: node.h:306
virtual node::Properties properties() const
Definition: node.h:891
Definition: statement.h:15
static auto create(ASTContext *ctx, hilti::Expression *expr, hilti::Expression *msg=nullptr, Meta meta={})
Definition: assert.h:43
static auto create(ASTContext *ctx, assert::Exception, hilti::Expression *expr, UnqualifiedType *excpt, hilti::Expression *msg=nullptr, Meta meta={})
Definition: assert.h:57
node::Properties properties() const final
Definition: assert.h:29