|
MXVM 1.8.1
Virtual Machine, Compiler, and Pascal Frontend
|
AST node for an if-then-else statement. More...
#include <ast.hpp>

Public Member Functions | |
| IfStmtNode (std::unique_ptr< ASTNode > cond, std::unique_ptr< ASTNode > thenStmt, std::unique_ptr< ASTNode > elseStmt=nullptr) | |
| 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< ASTNode > | condition |
| boolean condition | |
| std::unique_ptr< ASTNode > | thenStatement |
| then branch | |
| std::unique_ptr< ASTNode > | elseStatement |
| optional else branch | |
|
inline |
Definition at line 356 of file ast.hpp.
References condition, elseStatement, and thenStatement.
|
overridevirtual |
Accept an ASTVisitor (double-dispatch).
Implements pascal::ASTNode.
Definition at line 125 of file ast.cpp.
References pascal::ASTVisitor::visit().
|
overridevirtual |
Return a human-readable description of this node.
Implements pascal::ASTNode.
Definition at line 129 of file ast.cpp.
References elseStatement.
| std::unique_ptr<ASTNode> pascal::IfStmtNode::condition |
boolean condition
Definition at line 352 of file ast.hpp.
Referenced by IfStmtNode(), and pascal::CodeGenVisitor::visit().
| std::unique_ptr<ASTNode> pascal::IfStmtNode::elseStatement |
optional else branch
Definition at line 354 of file ast.hpp.
Referenced by IfStmtNode(), toString(), and pascal::CodeGenVisitor::visit().
| std::unique_ptr<ASTNode> pascal::IfStmtNode::thenStatement |
then branch
Definition at line 353 of file ast.hpp.
Referenced by IfStmtNode(), and pascal::CodeGenVisitor::visit().