Gyoji Compiler
|
Represents the safety/borrow check semantics for a function or block. More...
#include <tree.hpp>
Public Member Functions | |
UnsafeModifier (Gyoji::owned< Terminal > _unsafe_token) | |
UnsafeModifier (const Gyoji::context::SourceReference &_source_ref) | |
~UnsafeModifier () | |
bool | is_unsafe () 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 the safety/borrow check semantics for a function or block.
This is used to mark a function or a scope block as making use of unsafe language features. This is inspired by the Rust keyword of the same name. The semantics are such that unsafe blocks may use unsafe language features such as access to raw pointers, but the programmer is expected to make sure that the access is safe in practice even if the compiler cannot prove this. Functions declared as unsafe may also only be used inside unsafe blocks, so that the unsafe code may be contained to only specifically marked areas of the code.
UnsafeModifier::UnsafeModifier | ( | Gyoji::owned< Terminal > | _unsafe_token | ) |
Constructs an unsafe modifier from the parse token in the input. This indicates that a block HAS been marked as unsafe.
UnsafeModifier::UnsafeModifier | ( | const Gyoji::context::SourceReference & | _source_ref | ) |
The default unsafe modifier (i.e. not specified) refers to a block that is NOT marked as unsafe.
UnsafeModifier::~UnsafeModifier | ( | ) |
Destructor, nothing special.
bool UnsafeModifier::is_unsafe | ( | ) | const |
Returns true if the block or function has been marked as unsafe.