Spicy
Public Member Functions | List of all members
hilti::statement::Assert Class Reference

#include <assert.h>

Inheritance diagram for hilti::statement::Assert:
hilti::NodeBase hilti::trait::isStatement hilti::trait::isNode hilti::trait::isNode

Public Member Functions

 Assert (::hilti::Expression expr, std::optional<::hilti::Expression > msg, Meta m=Meta())
 
 Assert (assert::Exception, ::hilti::Expression expr, std::optional< Type > excpt, std::optional<::hilti::Expression > msg, Meta m=Meta())
 
bool expectsException () const
 
const auto & expression () const
 
auto exception () const
 
auto message () const
 
void setCondition (hilti::Expression c)
 
bool operator== (const Assert &other) const
 
auto isEqual (const Statement &other) const
 
auto properties () const
 
- Public Member Functions inherited from hilti::NodeBase
 NodeBase (Meta meta)
 
 NodeBase (std::vector< Node > childs, Meta meta)
 
template<typename T >
const T & child (int i) const
 
template<typename T >
void assertChildIsA (int i)
 
template<typename T >
auto childs (int begin, int end) const
 
auto childRefs (int begin, int end)
 
template<typename T >
hilti::node::Set< T > childsOfType () const
 
template<typename T >
std::vector< NodeRefchildRefsOfType () const
 
void addChild (Node n)
 
const auto & childs () const
 
auto & childs ()
 
auto & meta () const
 
void setMeta (Meta m)
 
bool pruneWalk () const
 

Detailed Description

AST node for an assert statement.

Constructor & Destructor Documentation

◆ Assert() [1/2]

hilti::statement::Assert::Assert ( ::hilti::Expression  expr,
std::optional<::hilti::Expression >  msg,
Meta  m = Meta() 
)
inline

Creates an assert statement that expects an exception to evaluate to true at runtime.

Parameters
eexpression to evaluate at runtime
msgmessage to report an runtime if assertions fails
mmeta informatio for AST node

◆ Assert() [2/2]

hilti::statement::Assert::Assert ( assert::Exception  ,
::hilti::Expression  expr,
std::optional< Type excpt,
std::optional<::hilti::Expression >  msg,
Meta  m = Meta() 
)
inline

Creates an assert statement that expects an exception to occur when the expression is evaluated.

Parameters
assert::Exceptiontag to select this constructor
eexpression to evaluate at runtime
typeexception type that's expected to be thrown when e is evaluated; unset of any exception
msgmessage to report an runtime if assertions fails
mmeta informatio for AST node

Member Function Documentation

◆ isEqual()

auto hilti::statement::Assert::isEqual ( const Statement &  other) const
inline

Implements the Statement interface.

◆ properties()

auto hilti::statement::Assert::properties ( ) const
inline

Implements the Node interface.


The documentation for this class was generated from the following file: