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

Represents a statement that evaluates an expression. More...

#include <bond/compiler/parsenodes.h>

Inheritance diagram for Bond::ExpressionStatement:
Bond::ListParseNode Bond::ParseNode

Public Member Functions

 ExpressionStatement (Expression *expression, const Token *declaratorName=nullptr)
 Constructs an expression statement.
virtual ~ExpressionStatement ()
 Destroys an ExpressionStatement object.
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.
Expression * GetExpression ()
 Returns the statement expression.
const Expression * GetExpression () const
 Returns the statement expression.
const Token * GetDeclaratorName () const
 Returns the token of the name that would have been declared if the statement were an uninitialized variable declaration, or null if it does not have that shape.
Public Member Functions inherited from Bond::ListParseNode
virtual ~ListParseNode ()
 Destroys a ListParseNode object.
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 ()
 Destroys a ParseNode object.

Additional Inherited Members

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

Detailed Description

Represents a statement that evaluates an expression.

Constructor & Destructor Documentation

◆ ExpressionStatement()

Bond::ExpressionStatement::ExpressionStatement ( Expression * expression,
const Token * declaratorName = nullptr )
inlineexplicit

Constructs an expression statement.

Parameters
expressionExpression to evaluate, or null for empty statements.
declaratorNameFor a statement that has the shape of an uninitialized variable declaration (e.g. A * b;), the token of the name that would have been declared. Used to report a missing initializer if the statement turns out to be a declaration.

◆ ~ExpressionStatement()

virtual Bond::ExpressionStatement::~ExpressionStatement ( )
inlinevirtual

Destroys an ExpressionStatement object.

Member Function Documentation

◆ Accept() [1/2]

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

Dispatches this node to the given visitor.

Parameters
visitorVisitor that handles this node type.

Implements Bond::ParseNode.

◆ GetContextToken()

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

◆ GetDeclaratorName()

const Token * Bond::ExpressionStatement::GetDeclaratorName ( ) const
inline

Returns the token of the name that would have been declared if the statement were an uninitialized variable declaration, or null if it does not have that shape.

◆ GetExpression() [1/2]

Expression * Bond::ExpressionStatement::GetExpression ( )
inline

Returns the statement expression.

◆ GetExpression() [2/2]

const Expression * Bond::ExpressionStatement::GetExpression ( ) const
inline

Returns the statement expression.


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