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

Represents the safety/borrow check semantics for a function or block. More...

#include <tree.hpp>

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

Public Member Functions

 UnsafeModifier (Gyoji::owned< Terminal > _unsafe_token)
 
 UnsafeModifier (const Gyoji::context::SourceReference &_source_ref)
 
 ~UnsafeModifier ()
 
bool is_unsafe () 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 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.

Constructor & Destructor Documentation

◆ UnsafeModifier() [1/2]

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() [2/2]

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

Destructor, nothing special.

Member Function Documentation

◆ is_unsafe()

bool UnsafeModifier::is_unsafe ( ) const

Returns true if the block or function has been marked as unsafe.


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