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

AST node for an array element access (arr[index]). More...

#include <ast.hpp>

Inheritance diagram for pascal::ArrayAccessNode:

Public Member Functions

 ArrayAccessNode (std::unique_ptr< ASTNode > base, std::unique_ptr< ASTNode > index)
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::unique_ptr< ASTNodebase
 array expression
std::unique_ptr< ASTNodeindex
 index expression

Detailed Description

AST node for an array element access (arr[index]).

Definition at line 321 of file ast.hpp.

Constructor & Destructor Documentation

◆ ArrayAccessNode()

pascal::ArrayAccessNode::ArrayAccessNode ( std::unique_ptr< ASTNode > base,
std::unique_ptr< ASTNode > index )
inline

Definition at line 326 of file ast.hpp.

References base, and index.

Member Function Documentation

◆ accept()

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

Accept an ASTVisitor (double-dispatch).

Implements pascal::ASTNode.

Definition at line 334 of file ast.cpp.

References pascal::ASTVisitor::visit().

◆ toString()

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

Return a human-readable description of this node.

Implements pascal::ASTNode.

Definition at line 338 of file ast.cpp.

Member Data Documentation

◆ base

std::unique_ptr<ASTNode> pascal::ArrayAccessNode::base

◆ index

std::unique_ptr<ASTNode> pascal::ArrayAccessNode::index

index expression

Definition at line 324 of file ast.hpp.

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


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