MXVM 1.8.1
Virtual Machine, Compiler, and Pascal Frontend
Loading...
Searching...
No Matches
pascal::FuncDeclNode Class Reference

AST node for a function declaration. More...

#include <ast.hpp>

Inheritance diagram for pascal::FuncDeclNode:

Public Member Functions

 FuncDeclNode (const std::string &n, std::vector< std::unique_ptr< ASTNode > > p, const std::string &rt, std::unique_ptr< ASTNode > b)
void accept (ASTVisitor &visitor) override
 Accept an ASTVisitor (double-dispatch).
std::string toString () const override
 Return a human-readable description of this node.
Public Member Functions inherited from pascal::ASTNode
virtual ~ASTNode ()=default
virtual void print (std::ostream &out, int indent=0) const
 Pretty-print this node to a stream with indentation.
void setLineNumber (int line)
 Set the originating source line number.
int getLineNumber () const
 Get the originating source line number.

Public Attributes

std::string name
 function name
std::vector< std::unique_ptr< ASTNode > > parameters
 formal parameters
std::string returnType
 return type name
std::shared_ptr< ASTNodeblock
 function body block

Detailed Description

AST node for a function declaration.

Definition at line 194 of file ast.hpp.

Constructor & Destructor Documentation

◆ FuncDeclNode()

pascal::FuncDeclNode::FuncDeclNode ( const std::string & n,
std::vector< std::unique_ptr< ASTNode > > p,
const std::string & rt,
std::unique_ptr< ASTNode > b )
inline

Definition at line 201 of file ast.hpp.

References block, name, parameters, and returnType.

Member Function Documentation

◆ accept()

void pascal::FuncDeclNode::accept ( ASTVisitor & visitor)
overridevirtual

Accept an ASTVisitor (double-dispatch).

Implements pascal::ASTNode.

Definition at line 83 of file ast.cpp.

References pascal::ASTVisitor::visit().

◆ toString()

std::string pascal::FuncDeclNode::toString ( ) const
overridevirtual

Return a human-readable description of this node.

Implements pascal::ASTNode.

Definition at line 87 of file ast.cpp.

References name, and returnType.

Member Data Documentation

◆ block

std::shared_ptr<ASTNode> pascal::FuncDeclNode::block

function body block

Definition at line 199 of file ast.hpp.

Referenced by FuncDeclNode(), and pascal::CodeGenVisitor::visit().

◆ name

std::string pascal::FuncDeclNode::name

function name

Definition at line 196 of file ast.hpp.

Referenced by FuncDeclNode(), toString(), and pascal::CodeGenVisitor::visit().

◆ parameters

std::vector<std::unique_ptr<ASTNode> > pascal::FuncDeclNode::parameters

formal parameters

Definition at line 197 of file ast.hpp.

Referenced by FuncDeclNode(), and pascal::CodeGenVisitor::visit().

◆ returnType

std::string pascal::FuncDeclNode::returnType

return type name

Definition at line 198 of file ast.hpp.

Referenced by FuncDeclNode(), toString(), and pascal::CodeGenVisitor::visit().


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