7 #include <hilti/ast/expression.h> 8 #include <hilti/ast/statement.h> 31 Assert(::hilti::Expression expr, std::optional<::hilti::Expression> msg,
Meta m =
Meta())
45 std::optional<::hilti::Expression> msg,
Meta m =
Meta())
46 :
NodeBase(nodes(
std::move(expr),
std::move(excpt),
std::move(msg)),
std::move(m)), _expects_exception(true) {}
48 bool expectsException()
const {
return _expects_exception; }
49 const auto& expression()
const {
return child<::hilti::Expression>(0); }
50 auto exception()
const {
return type::effectiveOptionalType(childs()[1].tryAs<Type>()); }
51 auto message()
const {
return childs()[2].tryReferenceAs<::hilti::Expression>(); }
53 bool operator==(
const Assert& other)
const {
54 return _expects_exception == other._expects_exception && expression() == other.expression() &&
55 exception() == other.exception() && message() == other.message();
59 auto isEqual(
const Statement& other)
const {
return node::isEqual(
this, other); }
72 auto x = Statement(e)._clone().as<
Assert>();
78 bool _expects_exception =
false;
Assert(::hilti::Expression expr, std::optional<::hilti::Expression > msg, Meta m=Meta())
Definition: assert.h:31
std::vector< T > childs(int begin, int end) const
Definition: node.h:373
auto isEqual(const Statement &other) const
Definition: assert.h:59
auto properties() const
Definition: assert.h:62
Definition: optional.h:79
static Statement setCondition(const Assert &e, const hilti::Expression &c)
Definition: assert.h:71
Assert(assert::Exception, ::hilti::Expression expr, std::optional< Type > excpt, std::optional<::hilti::Expression > msg, Meta m=Meta())
Definition: assert.h:44
Definition: statement.h:14
std::map< std::string, node::detail::PropertyValue > Properties
Definition: node.h:83