Gyoji Compiler
|
Represents a block of statements in a particular scope. More...
#include <tree.hpp>
Public Member Functions | |
StatementBlock (Gyoji::owned< UnsafeModifier > _unsafe_modifier, Gyoji::owned< ScopeBody > _scope_body) | |
~StatementBlock () | |
const UnsafeModifier & | get_unsafe_modifier () const |
const ScopeBody & | get_scope_body () const |
![]() | |
SyntaxNode (Gyoji::context::TokenID _type, specific_type_t _data, const Gyoji::context::SourceReference &_source_ref) | |
const std::vector< std::reference_wrapper< const SyntaxNode > > & | get_children () const |
const Gyoji::context::TokenID & | get_type () const |
template<class T > | |
bool | has_data () const |
template<class T > | |
const T & | get_data () const |
const SyntaxNode & | get_syntax_node () const |
const Gyoji::context::SourceReference & | get_source_ref () const |
Represents a block of statements in a particular scope.
This statement consists of a block of statements in a particular scope. It may be optionally marked as unsafe, indicating that it may contain raw pointers and other potentially unsafe semantics.
For example, this is a scope block defined as unsafe because is makes use of potentially unsafe semantics such as raw pointer indirection.
void foo() { u32 q; unsafe { u32 *x = &q; *x = 'p'; } }
StatementBlock::StatementBlock | ( | Gyoji::owned< UnsafeModifier > | _unsafe_modifier, |
Gyoji::owned< ScopeBody > | _scope_body | ||
) |
Used in the parse stage to create a block of statements with an optional unsafe modifier.
StatementBlock::~StatementBlock | ( | ) |
Destructor, nothing special.
const ScopeBody & StatementBlock::get_scope_body | ( | ) | const |
Returns the scope body containing the statements defined by the scope.
const UnsafeModifier & StatementBlock::get_unsafe_modifier | ( | ) | const |
Returns the unsafe modifier associated with the block.