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

Represents a using-directive that opens a namespace's symbols into local scope. More...

#include <bond/compiler/parsenodes.h>

Inheritance diagram for Bond::UsingDirective:
Bond::ListParseNode Bond::ParseNode

Public Member Functions

 UsingDirective (QualifiedIdentifier *identifier)
 Constructs a using-directive.
virtual ~UsingDirective ()
 Destroys a UsingDirective 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.
QualifiedIdentifier * GetIdentifier ()
 Returns the qualified identifier naming the namespace to open.
const QualifiedIdentifier * GetIdentifier () const
 Returns the qualified identifier naming the namespace to open.
void SetNamespace (Symbol *space)
 Sets the resolved namespace symbol that this directive opens.
Symbol * GetNamespace ()
 Returns the resolved namespace symbol that this directive opens, if any.
const Symbol * GetNamespace () const
 Returns the resolved namespace symbol that this directive opens, if any.
void SetEnclosingNamespace (Symbol *space)
 Sets the nearest namespace that encloses both this directive and the namespace it opens.
Symbol * GetEnclosingNamespace ()
 Returns the nearest namespace that encloses both this directive and the namespace it opens.
const Symbol * GetEnclosingNamespace () const
 Returns the nearest namespace that encloses both this directive and the namespace it opens.
UsingDirective * GetNextUsingDirective ()
 Returns the next using-directive opened in the same local scope.
const UsingDirective * GetNextUsingDirective () const
 Returns the next using-directive opened in the same local scope.
void SetNextUsingDirective (UsingDirective *next)
 Links this directive into its enclosing scope's list of opened namespaces.
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 using-directive that opens a namespace's symbols into local scope.

Never enters a symbol table; it is instead threaded into its enclosing local scope's list of opened namespaces (via its own dedicated next-pointer, separate from the ListParseNode next-pointer used to place it among the enclosing statement list). During unqualified lookup from within that scope, the opened namespace's members are treated as members of the nearest namespace that encloses both the directive and the opened namespace, as in C++.

Constructor & Destructor Documentation

◆ UsingDirective()

Bond::UsingDirective::UsingDirective ( QualifiedIdentifier * identifier)
inlineexplicit

Constructs a using-directive.

Parameters
identifierQualified identifier naming the namespace to open.

◆ ~UsingDirective()

virtual Bond::UsingDirective::~UsingDirective ( )
inlinevirtual

Destroys a UsingDirective object.

Member Function Documentation

◆ Accept() [1/2]

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

◆ GetEnclosingNamespace() [1/2]

Symbol * Bond::UsingDirective::GetEnclosingNamespace ( )
inline

Returns the nearest namespace that encloses both this directive and the namespace it opens.

◆ GetEnclosingNamespace() [2/2]

const Symbol * Bond::UsingDirective::GetEnclosingNamespace ( ) const
inline

Returns the nearest namespace that encloses both this directive and the namespace it opens.

◆ GetIdentifier() [1/2]

QualifiedIdentifier * Bond::UsingDirective::GetIdentifier ( )
inline

Returns the qualified identifier naming the namespace to open.

◆ GetIdentifier() [2/2]

const QualifiedIdentifier * Bond::UsingDirective::GetIdentifier ( ) const
inline

Returns the qualified identifier naming the namespace to open.

◆ GetNamespace() [1/2]

Symbol * Bond::UsingDirective::GetNamespace ( )
inline

Returns the resolved namespace symbol that this directive opens, if any.

◆ GetNamespace() [2/2]

const Symbol * Bond::UsingDirective::GetNamespace ( ) const
inline

Returns the resolved namespace symbol that this directive opens, if any.

◆ GetNextUsingDirective() [1/2]

UsingDirective * Bond::UsingDirective::GetNextUsingDirective ( )
inline

Returns the next using-directive opened in the same local scope.

◆ GetNextUsingDirective() [2/2]

const UsingDirective * Bond::UsingDirective::GetNextUsingDirective ( ) const
inline

Returns the next using-directive opened in the same local scope.

◆ SetEnclosingNamespace()

void Bond::UsingDirective::SetEnclosingNamespace ( Symbol * space)
inline

Sets the nearest namespace that encloses both this directive and the namespace it opens.

Parameters
spaceThe enclosing namespace, to whose members the opened namespace's members are added.

◆ SetNamespace()

void Bond::UsingDirective::SetNamespace ( Symbol * space)
inline

Sets the resolved namespace symbol that this directive opens.

Parameters
spaceNamespace symbol to open into the enclosing local scope.

◆ SetNextUsingDirective()

void Bond::UsingDirective::SetNextUsingDirective ( UsingDirective * next)
inline

Links this directive into its enclosing scope's list of opened namespaces.

Parameters
nextNext using-directive in the scope's list.

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