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

Represents a for loop and its local scope. More...

#include <bond/compiler/parsenodes.h>

Inheritance diagram for Bond::ForStatement:
Bond::Symbol Bond::ListParseNode Bond::ParseNode

Public Member Functions

 ForStatement (const Token *keyword, ParseNode *initializer, Expression *condition, Expression *countingExpression, ParseNode *body)
 Constructs a for statement.
virtual ~ForStatement ()
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 SymbolType GetSymbolType () const override
 Returns the concrete symbol type.
virtual const TokenGetContextToken () const override
 Returns the token used as source context for diagnostics.
const TokenGetKeyword () const
 Returns the for keyword token.
ParseNodeGetInitializer ()
 Returns the loop initializer.
const ParseNodeGetInitializer () const
 Returns the loop initializer.
ExpressionGetCondition ()
 Returns the loop condition expression.
const ExpressionGetCondition () const
 Returns the loop condition expression.
ExpressionGetCountingExpression ()
 Returns the loop counting expression.
const ExpressionGetCountingExpression () const
 Returns the loop counting expression.
ParseNodeGetBody ()
 Returns the loop body.
const ParseNodeGetBody () const
 Returns the loop body.
Public Member Functions inherited from Bond::Symbol
virtual ~Symbol ()
virtual const TokenGetName () const
 Returns the symbol name token.
virtual TypeAndValueGetTypeAndValue ()
 Returns the symbol's type-and-value metadata.
virtual const TypeAndValueGetTypeAndValue () const
 Returns the symbol's type-and-value metadata.
virtual bool IsResolved () const
 Returns true when symbol resolution has completed for this symbol.
bool IsTypeDefinition () const
 Returns true if this symbol defines a type.
SymbolGetParentSymbol ()
 Returns the enclosing symbol.
const SymbolGetParentSymbol () const
 Returns the enclosing symbol.
void SetParentSymbol (Symbol *parent)
 Sets the enclosing symbol.
SymbolFindSymbol (const StringView &name)
 Finds a directly contained symbol by name.
const SymbolFindSymbol (const StringView &name) const
 Finds a directly contained symbol by name.
SymbolFindSymbol (const Token *name)
 Finds a directly contained symbol by token text.
const SymbolFindSymbol (const Token *name) const
 Finds a directly contained symbol by token text.
SymbolFindSymbol (const QualifiedIdentifier *identifier)
 Finds a symbol referenced by a qualified identifier.
const SymbolFindSymbol (const QualifiedIdentifier *identifier) const
 Finds a symbol referenced by a qualified identifier.
void InsertSymbol (Symbol *symbol)
 Inserts a symbol into this symbol's child list.
bool IsAnonymous () const
 Returns true if this symbol has no explicit name.
bool Matches (const StringView &name) const
 Returns true if this symbol's name matches the given text.
Public Member Functions inherited from Bond::ListParseNode
virtual ~ListParseNode ()
ListParseNodeGetNextNode ()
 Returns the next node in the list.
const ListParseNodeGetNextNode () 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

Public Types inherited from Bond::Symbol
enum  SymbolType {
  TYPE_NAMESPACE , TYPE_STRUCT , TYPE_ENUM , TYPE_LOCALSCOPE ,
  TYPE_VALUE , TYPE_FUNCTION
}
 Identifies the concrete symbol category. More...
Protected Member Functions inherited from Bond::Symbol
 Symbol ()
Protected Member Functions inherited from Bond::ListParseNode
 ListParseNode ()
Protected Member Functions inherited from Bond::ParseNode
 ParseNode ()

Detailed Description

Represents a for loop and its local scope.

Constructor & Destructor Documentation

◆ ForStatement()

Bond::ForStatement::ForStatement ( const Token * keyword,
ParseNode * initializer,
Expression * condition,
Expression * countingExpression,
ParseNode * body )
inline

Constructs a for statement.

Parameters
keywordFor keyword token.
initializerOptional initializer statement.
conditionOptional condition expression.
countingExpressionOptional counting expression.
bodyLoop body.

◆ ~ForStatement()

virtual Bond::ForStatement::~ForStatement ( )
inlinevirtual

Member Function Documentation

◆ Accept() [1/2]

virtual void Bond::ForStatement::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::ForStatement::Accept ( ParseNodeVisitor & visitor)
inlineoverridevirtual

Dispatches this node to the given visitor.

Parameters
visitorVisitor that handles this node type.

Implements Bond::ParseNode.

◆ GetBody() [1/2]

ParseNode * Bond::ForStatement::GetBody ( )
inline

Returns the loop body.

◆ GetBody() [2/2]

const ParseNode * Bond::ForStatement::GetBody ( ) const
inline

Returns the loop body.

◆ GetCondition() [1/2]

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

Returns the loop condition expression.

◆ GetCondition() [2/2]

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

Returns the loop condition expression.

◆ GetContextToken()

virtual const Token * Bond::ForStatement::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.

Reimplemented from Bond::Symbol.

◆ GetCountingExpression() [1/2]

Expression * Bond::ForStatement::GetCountingExpression ( )
inline

Returns the loop counting expression.

◆ GetCountingExpression() [2/2]

const Expression * Bond::ForStatement::GetCountingExpression ( ) const
inline

Returns the loop counting expression.

◆ GetInitializer() [1/2]

ParseNode * Bond::ForStatement::GetInitializer ( )
inline

Returns the loop initializer.

◆ GetInitializer() [2/2]

const ParseNode * Bond::ForStatement::GetInitializer ( ) const
inline

Returns the loop initializer.

◆ GetKeyword()

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

Returns the for keyword token.

◆ GetSymbolType()

virtual SymbolType Bond::ForStatement::GetSymbolType ( ) const
inlineoverridevirtual

Returns the concrete symbol type.

Implements Bond::Symbol.


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