GSC Interpreter
A Turing-complete interpreter developed for a compiler course
Loading...
Searching...
No Matches
Block Class Reference

Represents a block of statements. More...

#include <stmt.hpp>

Inheritance diagram for Block:
Collaboration diagram for Block:

Public Member Functions

 Block (std::vector< std::shared_ptr< Stmt > > statements)
 
std::any accept (StmtVisitor &visitor) override
 
std::vector< std::shared_ptr< Stmt > > getStatements () const
 

Private Attributes

const std::vector< std::shared_ptr< Stmt > > statements
 

Detailed Description

Represents a block of statements.

Note
This class holds a vector of statements and allows visiting them.

Definition at line 48 of file stmt.hpp.

Constructor & Destructor Documentation

◆ Block()

Block::Block ( std::vector< std::shared_ptr< Stmt > >  statements)
inline

Definition at line 53 of file stmt.hpp.

54 : statements(std::move(statements)) {}
const std::vector< std::shared_ptr< Stmt > > statements
Definition stmt.hpp:50

Member Function Documentation

◆ accept()

std::any Block::accept ( StmtVisitor visitor)
inlineoverridevirtual

Implements Stmt.

Definition at line 56 of file stmt.hpp.

56 {
57 return visitor.visitBlockStmt(shared_from_this());
58 }
virtual std::any visitBlockStmt(std::shared_ptr< Block > stmt)=0

◆ getStatements()

std::vector< std::shared_ptr< Stmt > > Block::getStatements ( ) const
inline

Definition at line 60 of file stmt.hpp.

60 {
61 return statements;
62 }

Member Data Documentation

◆ statements

const std::vector<std::shared_ptr<Stmt> > Block::statements
private

Definition at line 50 of file stmt.hpp.


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