Bond 0.9
C++ Bond Runtime Library API Documentation
Loading...
Searching...
No Matches
Bond::IfStatement Class Reference

Represents an if/else statement. More...

#include <bond/compiler/parsenodes.h>

Inheritance diagram for Bond::IfStatement:
Bond::ListParseNode Bond::ParseNode

Public Member Functions

 IfStatement (const Token *keyword, Expression *condition, ParseNode *thenStatement, ParseNode *elseStatement)
 Constructs an if statement.
virtual ~IfStatement ()
virtual void Accept (ParseNodeVisitor &visitor) override
 Dispatches this node to the given visitor.
virtual void Accept (ParseNodeVisitor &visitor) const override
 Dispatches this node to the given visitor.
virtual const Token * GetContextToken () const override
 Returns the token used as source context for diagnostics.
const Token * GetKeyword () const
 Returns the if keyword token.
Expression * GetCondition ()
 Returns the condition expression.
const Expression * GetCondition () const
 Returns the condition expression.
ParseNode * GetThenStatement ()
 Returns the then-branch statement.
const ParseNode * GetThenStatement () const
 Returns the then-branch statement.
ParseNode * GetElseStatement ()
 Returns the else-branch statement.
const ParseNode * GetElseStatement () const
 Returns the else-branch statement.
Public Member Functions inherited from Bond::ListParseNode
virtual ~ListParseNode ()
ListParseNode * GetNextNode ()
 Returns the next node in the list.
const ListParseNode * GetNextNode () const
 Returns the next node in the list.
void SetNextNode (ListParseNode *next)
 Sets the next node in the list.
Public Member Functions inherited from Bond::ParseNode
virtual ~ParseNode ()

Additional Inherited Members

Protected Member Functions inherited from Bond::ListParseNode
 ListParseNode ()
Protected Member Functions inherited from Bond::ParseNode
 ParseNode ()

Detailed Description

Represents an if/else statement.

Constructor & Destructor Documentation

◆ IfStatement()

Bond::IfStatement::IfStatement ( const Token * keyword,
Expression * condition,
ParseNode * thenStatement,
ParseNode * elseStatement )
inline

Constructs an if statement.

Parameters
keywordIf keyword token.
conditionCondition expression.
thenStatementStatement executed when condition is true.
elseStatementOptional statement executed when condition is false.

◆ ~IfStatement()

virtual Bond::IfStatement::~IfStatement ( )
inlinevirtual

Member Function Documentation

◆ Accept() [1/2]

virtual void Bond::IfStatement::Accept ( ParseNodeVisitor & visitor) const
inlineoverridevirtual

Dispatches this node to the given visitor.

Parameters
visitorVisitor that handles this node type.

Implements Bond::ParseNode.

◆ Accept() [2/2]

virtual void Bond::IfStatement::Accept ( ParseNodeVisitor & visitor)
inlineoverridevirtual

Dispatches this node to the given visitor.

Parameters
visitorVisitor that handles this node type.

Implements Bond::ParseNode.

◆ GetCondition() [1/2]

Expression * Bond::IfStatement::GetCondition ( )
inline

Returns the condition expression.

◆ GetCondition() [2/2]

const Expression * Bond::IfStatement::GetCondition ( ) const
inline

Returns the condition expression.

◆ GetContextToken()

virtual const Token * Bond::IfStatement::GetContextToken ( ) const
inlineoverridevirtual

Returns the token used as source context for diagnostics.

Returns
A token associated with this node, or null if no token applies.

Implements Bond::ParseNode.

◆ GetElseStatement() [1/2]

ParseNode * Bond::IfStatement::GetElseStatement ( )
inline

Returns the else-branch statement.

◆ GetElseStatement() [2/2]

const ParseNode * Bond::IfStatement::GetElseStatement ( ) const
inline

Returns the else-branch statement.

◆ GetKeyword()

const Token * Bond::IfStatement::GetKeyword ( ) const
inline

Returns the if keyword token.

◆ GetThenStatement() [1/2]

ParseNode * Bond::IfStatement::GetThenStatement ( )
inline

Returns the then-branch statement.

◆ GetThenStatement() [2/2]

const ParseNode * Bond::IfStatement::GetThenStatement ( ) const
inline

Returns the then-branch statement.


The documentation for this class was generated from the following file:
  • include/bond/compiler/parsenodes.h