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

Represents a case or default label in a switch section. More...

#include <bond/compiler/parsenodes.h>

Inheritance diagram for Bond::SwitchLabel:
Bond::ListParseNode Bond::ParseNode

Public Member Functions

 SwitchLabel (const Token *label)
 Constructs a default-style switch label with no expression.
 SwitchLabel (const Token *label, Expression *expression)
 Constructs a case label with an expression.
virtual ~SwitchLabel ()
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 * GetLabel () const
 Returns the label token.
Expression * GetExpression ()
 Returns the case expression.
const Expression * GetExpression () const
 Returns the case expression.
ResolvedSwitchLabel & GetResolvedLabel ()
 Returns resolved label metadata.
const ResolvedSwitchLabel & GetResolvedLabel () const
 Returns resolved label metadata.
bool IsDefaultLabel () const
 Returns true if this label is a default label.
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 a case or default label in a switch section.

Constructor & Destructor Documentation

◆ SwitchLabel() [1/2]

Bond::SwitchLabel::SwitchLabel ( const Token * label)
inlineexplicit

Constructs a default-style switch label with no expression.

Parameters
labelLabel token.

◆ SwitchLabel() [2/2]

Bond::SwitchLabel::SwitchLabel ( const Token * label,
Expression * expression )
inline

Constructs a case label with an expression.

Parameters
labelLabel token.
expressionCase match expression.

◆ ~SwitchLabel()

virtual Bond::SwitchLabel::~SwitchLabel ( )
inlinevirtual

Member Function Documentation

◆ Accept() [1/2]

virtual void Bond::SwitchLabel::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::SwitchLabel::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::SwitchLabel::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.

◆ GetExpression() [1/2]

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

Returns the case expression.

◆ GetExpression() [2/2]

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

Returns the case expression.

◆ GetLabel()

const Token * Bond::SwitchLabel::GetLabel ( ) const
inline

Returns the label token.

◆ GetResolvedLabel() [1/2]

ResolvedSwitchLabel & Bond::SwitchLabel::GetResolvedLabel ( )
inline

Returns resolved label metadata.

◆ GetResolvedLabel() [2/2]

const ResolvedSwitchLabel & Bond::SwitchLabel::GetResolvedLabel ( ) const
inline

Returns resolved label metadata.

◆ IsDefaultLabel()

bool Bond::SwitchLabel::IsDefaultLabel ( ) const
inline

Returns true if this label is a default label.


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