Gyoji Compiler
Loading...
Searching...
No Matches
Public Member Functions | List of all members
Gyoji::frontend::tree::StatementBlock Class Reference

Represents a block of statements in a particular scope. More...

#include <tree.hpp>

Inheritance diagram for Gyoji::frontend::tree::StatementBlock:
Inheritance graph
[legend]
Collaboration diagram for Gyoji::frontend::tree::StatementBlock:
Collaboration graph
[legend]

Public Member Functions

 StatementBlock (Gyoji::owned< UnsafeModifier > _unsafe_modifier, Gyoji::owned< ScopeBody > _scope_body)
 
 ~StatementBlock ()
 
const UnsafeModifierget_unsafe_modifier () const
 
const ScopeBody & get_scope_body () const
 
- Public Member Functions inherited from Gyoji::frontend::ast::SyntaxNode
 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 SyntaxNodeget_syntax_node () const
 
const Gyoji::context::SourceReferenceget_source_ref () const
 

Detailed Description

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';
    }
}

Constructor & Destructor Documentation

◆ StatementBlock()

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::~StatementBlock ( )

Destructor, nothing special.

Member Function Documentation

◆ get_scope_body()

const ScopeBody & StatementBlock::get_scope_body ( ) const

Returns the scope body containing the statements defined by the scope.

◆ get_unsafe_modifier()

const UnsafeModifier & StatementBlock::get_unsafe_modifier ( ) const

Returns the unsafe modifier associated with the block.


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