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

Represents a ternary conditional expression. More...

#include <bond/compiler/parsenodes.h>

Inheritance diagram for Bond::ConditionalExpression:
Bond::Expression Bond::ListParseNode Bond::ParseNode

Public Member Functions

 ConditionalExpression (const Token *op, Expression *condition, Expression *trueExpression, Expression *falseExpression)
 Constructs a conditional expression.
virtual ~ConditionalExpression ()
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 * GetCondition ()
 Returns the condition expression.
const Expression * GetCondition () const
 Returns the condition expression.
Expression * GetTrueExpression ()
 Returns the true branch expression.
const Expression * GetTrueExpression () const
 Returns the true branch expression.
Expression * GetFalseExpression ()
 Returns the false branch expression.
const Expression * GetFalseExpression () const
 Returns the false branch expression.
Public Member Functions inherited from Bond::Expression
virtual ~Expression ()
const TypeDescriptor & GetTypeDescriptor () const
 Returns the expression's type descriptor.
void SetTypeDescriptor (const TypeDescriptor &descriptor)
 Sets the expression's type descriptor.
const TypeAndValue & GetTypeAndValue () const
 Returns type and value metadata for the expression.
TypeAndValue & GetTypeAndValue ()
 Returns mutable type and value metadata for the expression.
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::Expression
 Expression ()
Protected Member Functions inherited from Bond::ListParseNode
 ListParseNode ()
Protected Member Functions inherited from Bond::ParseNode
 ParseNode ()

Detailed Description

Represents a ternary conditional expression.

Constructor & Destructor Documentation

◆ ConditionalExpression()

Bond::ConditionalExpression::ConditionalExpression ( const Token * op,
Expression * condition,
Expression * trueExpression,
Expression * falseExpression )
inline

Constructs a conditional expression.

Parameters
opConditional operator token.
conditionCondition expression.
trueExpressionExpression evaluated when condition is true.
falseExpressionExpression evaluated when condition is false.

◆ ~ConditionalExpression()

virtual Bond::ConditionalExpression::~ConditionalExpression ( )
inlinevirtual

Member Function Documentation

◆ Accept() [1/2]

virtual void Bond::ConditionalExpression::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::ConditionalExpression::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::ConditionalExpression::GetCondition ( )
inline

Returns the condition expression.

◆ GetCondition() [2/2]

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

Returns the condition expression.

◆ GetContextToken()

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

◆ GetFalseExpression() [1/2]

Expression * Bond::ConditionalExpression::GetFalseExpression ( )
inline

Returns the false branch expression.

◆ GetFalseExpression() [2/2]

const Expression * Bond::ConditionalExpression::GetFalseExpression ( ) const
inline

Returns the false branch expression.

◆ GetTrueExpression() [1/2]

Expression * Bond::ConditionalExpression::GetTrueExpression ( )
inline

Returns the true branch expression.

◆ GetTrueExpression() [2/2]

const Expression * Bond::ConditionalExpression::GetTrueExpression ( ) const
inline

Returns the true branch expression.


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