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

Represents a function declaration or definition. More...

#include <bond/compiler/parsenodes.h>

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

Public Member Functions

 FunctionDefinition (FunctionPrototype *prototype, CompoundStatement *body, TypeDescriptor *thisTypeDescriptor, Scope scope)
 Constructs a function definition node.
virtual ~FunctionDefinition ()
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 TokenGetName () const override
 Returns the symbol name token.
virtual TypeAndValueGetTypeAndValue () override
 Returns the symbol's type-and-value metadata.
virtual const TypeAndValueGetTypeAndValue () const override
 Returns the symbol's type-and-value metadata.
FunctionPrototypeGetPrototype ()
 Returns the function prototype.
const FunctionPrototypeGetPrototype () const
 Returns the function prototype.
CompoundStatementGetBody ()
 Returns the function body.
const CompoundStatementGetBody () const
 Returns the function body.
TypeDescriptorGetThisTypeDescriptor ()
 Returns the this-parameter type descriptor.
const TypeDescriptorGetThisTypeDescriptor () const
 Returns the this-parameter type descriptor.
Scope GetScope () const
 Returns the declaration scope of this function.
bool IsNative () const
 Returns true if this function is native (no Bond body).
size_t GetNumReservedJumpTargetIds () const
 Returns the number of reserved jump target IDs used by code generation.
void SetNumReservedJumpTargetIds (size_t numIds)
 Sets the number of reserved jump target IDs used by code generation.
Public Member Functions inherited from Bond::Symbol
virtual ~Symbol ()
virtual const TokenGetContextToken () const override
 Returns the token used as source context for diagnostics.
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 function declaration or definition.

Constructor & Destructor Documentation

◆ FunctionDefinition()

Bond::FunctionDefinition::FunctionDefinition ( FunctionPrototype * prototype,
CompoundStatement * body,
TypeDescriptor * thisTypeDescriptor,
Scope scope )
inline

Constructs a function definition node.

Parameters
prototypeFunction prototype.
bodyFunction body, or null for native functions.
thisTypeDescriptorThis-parameter type for member functions.
scopeScope in which the function is declared.

◆ ~FunctionDefinition()

virtual Bond::FunctionDefinition::~FunctionDefinition ( )
inlinevirtual

Member Function Documentation

◆ Accept() [1/2]

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

Dispatches this node to the given visitor.

Parameters
visitorVisitor that handles this node type.

Implements Bond::ParseNode.

◆ GetBody() [1/2]

CompoundStatement * Bond::FunctionDefinition::GetBody ( )
inline

Returns the function body.

◆ GetBody() [2/2]

const CompoundStatement * Bond::FunctionDefinition::GetBody ( ) const
inline

Returns the function body.

◆ GetName()

virtual const Token * Bond::FunctionDefinition::GetName ( ) const
inlineoverridevirtual

Returns the symbol name token.

Returns
The name token, or null for anonymous symbols.

Reimplemented from Bond::Symbol.

◆ GetNumReservedJumpTargetIds()

size_t Bond::FunctionDefinition::GetNumReservedJumpTargetIds ( ) const
inline

Returns the number of reserved jump target IDs used by code generation.

◆ GetPrototype() [1/2]

FunctionPrototype * Bond::FunctionDefinition::GetPrototype ( )
inline

Returns the function prototype.

◆ GetPrototype() [2/2]

const FunctionPrototype * Bond::FunctionDefinition::GetPrototype ( ) const
inline

Returns the function prototype.

◆ GetScope()

Scope Bond::FunctionDefinition::GetScope ( ) const
inline

Returns the declaration scope of this function.

◆ GetSymbolType()

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

Returns the concrete symbol type.

Implements Bond::Symbol.

◆ GetThisTypeDescriptor() [1/2]

TypeDescriptor * Bond::FunctionDefinition::GetThisTypeDescriptor ( )
inline

Returns the this-parameter type descriptor.

◆ GetThisTypeDescriptor() [2/2]

const TypeDescriptor * Bond::FunctionDefinition::GetThisTypeDescriptor ( ) const
inline

Returns the this-parameter type descriptor.

◆ GetTypeAndValue() [1/2]

virtual const TypeAndValue * Bond::FunctionDefinition::GetTypeAndValue ( ) const
inlineoverridevirtual

Returns the symbol's type-and-value metadata.

Returns
Type and value information, or null if not applicable.

Reimplemented from Bond::Symbol.

◆ GetTypeAndValue() [2/2]

virtual TypeAndValue * Bond::FunctionDefinition::GetTypeAndValue ( )
inlineoverridevirtual

Returns the symbol's type-and-value metadata.

Returns
Type and value information, or null if not applicable.

Reimplemented from Bond::Symbol.

◆ IsNative()

bool Bond::FunctionDefinition::IsNative ( ) const
inline

Returns true if this function is native (no Bond body).

◆ SetNumReservedJumpTargetIds()

void Bond::FunctionDefinition::SetNumReservedJumpTargetIds ( size_t numIds)
inline

Sets the number of reserved jump target IDs used by code generation.

Parameters
numIdsNumber of reserved jump target IDs.

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