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

Represents a parsed type specifier. More...

#include <bond/compiler/parsenodes.h>

Inheritance diagram for Bond::TypeSpecifier:
Bond::ParseNode

Public Member Functions

 TypeSpecifier (const Token *primitiveType, QualifiedIdentifier *identifier=nullptr)
 Constructs a type specifier from a primitive token and optional identifier.
 TypeSpecifier (QualifiedIdentifier *identifier)
 Constructs a non-primitive type specifier from an identifier.
 TypeSpecifier (const Token *primitiveType, QualifiedIdentifier *identifier, const Symbol *definition)
 Constructs a fully specified type specifier.
virtual ~TypeSpecifier ()
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 TokenGetContextToken () const override
 Returns the token used as source context for diagnostics.
const TokenGetPrimitiveTypeToken () const
 Returns the primitive type token.
QualifiedIdentifierGetIdentifier ()
 Returns the qualified identifier for this type.
const QualifiedIdentifierGetIdentifier () const
 Returns the qualified identifier for this type.
const SymbolGetDefinition () const
 Returns the resolved symbol definition for this type.
void SetDefinition (const Symbol *symbol)
 Sets the resolved symbol definition for this type.
bool IsResolved () const
 Returns true if this type specifier has been resolved.
bool IsInstantiable () const
 Returns true if values of this type can be instantiated.
uint32_t GetSize (PointerSize pointerSize) const
 Returns the object size of this type.
uint32_t GetAlignment () const
 Returns the alignment of this type.
SignatureType GetSignatureType () const
 Returns the signature encoding type for this type.
Token::TokenType GetPrimitiveType () const
 Returns the primitive token type, if applicable.
bool IsBooleanType () const
 Returns true if this type is boolean.
bool IsCharType () const
 Returns true if this type is character.
bool IsIntegerType () const
 Returns true if this type is integer.
bool IsLeast32IntegerType () const
 Returns true if this type is at least 32-bit integer.
bool IsMost32IntegerType () const
 Returns true if this type is at most 32-bit integer.
bool IsNumericType () const
 Returns true if this type is numeric.
bool IsVoidType () const
 Returns true if this type is void.
bool IsStructType () const
 Returns true if this type is a struct type.
Public Member Functions inherited from Bond::ParseNode
virtual ~ParseNode ()

Additional Inherited Members

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

Detailed Description

Represents a parsed type specifier.

Constructor & Destructor Documentation

◆ TypeSpecifier() [1/3]

Bond::TypeSpecifier::TypeSpecifier ( const Token * primitiveType,
QualifiedIdentifier * identifier = nullptr )
inlineexplicit

Constructs a type specifier from a primitive token and optional identifier.

Parameters
primitiveTypePrimitive type token, or null for non-primitive types.
identifierOptional qualified identifier for user-defined types.

◆ TypeSpecifier() [2/3]

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

Constructs a non-primitive type specifier from an identifier.

Parameters
identifierQualified identifier for the referenced type.

◆ TypeSpecifier() [3/3]

Bond::TypeSpecifier::TypeSpecifier ( const Token * primitiveType,
QualifiedIdentifier * identifier,
const Symbol * definition )
inline

Constructs a fully specified type specifier.

Parameters
primitiveTypePrimitive type token, or null for non-primitive types.
identifierQualified identifier for user-defined types.
definitionResolved symbol definition for this type.

◆ ~TypeSpecifier()

virtual Bond::TypeSpecifier::~TypeSpecifier ( )
inlinevirtual

Member Function Documentation

◆ Accept() [1/2]

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

Dispatches this node to the given visitor.

Parameters
visitorVisitor that handles this node type.

Implements Bond::ParseNode.

◆ GetAlignment()

uint32_t Bond::TypeSpecifier::GetAlignment ( ) const

Returns the alignment of this type.

◆ GetContextToken()

virtual const Token * Bond::TypeSpecifier::GetContextToken ( ) const
overridevirtual

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.

◆ GetDefinition()

const Symbol * Bond::TypeSpecifier::GetDefinition ( ) const
inline

Returns the resolved symbol definition for this type.

◆ GetIdentifier() [1/2]

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

Returns the qualified identifier for this type.

◆ GetIdentifier() [2/2]

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

Returns the qualified identifier for this type.

◆ GetPrimitiveType()

Token::TokenType Bond::TypeSpecifier::GetPrimitiveType ( ) const

Returns the primitive token type, if applicable.

◆ GetPrimitiveTypeToken()

const Token * Bond::TypeSpecifier::GetPrimitiveTypeToken ( ) const
inline

Returns the primitive type token.

Returns
Primitive type token, or null for non-primitive types.

◆ GetSignatureType()

SignatureType Bond::TypeSpecifier::GetSignatureType ( ) const

Returns the signature encoding type for this type.

◆ GetSize()

uint32_t Bond::TypeSpecifier::GetSize ( PointerSize pointerSize) const

Returns the object size of this type.

Parameters
pointerSizeTarget pointer size.

◆ IsBooleanType()

bool Bond::TypeSpecifier::IsBooleanType ( ) const

Returns true if this type is boolean.

◆ IsCharType()

bool Bond::TypeSpecifier::IsCharType ( ) const

Returns true if this type is character.

◆ IsInstantiable()

bool Bond::TypeSpecifier::IsInstantiable ( ) const

Returns true if values of this type can be instantiated.

◆ IsIntegerType()

bool Bond::TypeSpecifier::IsIntegerType ( ) const

Returns true if this type is integer.

◆ IsLeast32IntegerType()

bool Bond::TypeSpecifier::IsLeast32IntegerType ( ) const

Returns true if this type is at least 32-bit integer.

◆ IsMost32IntegerType()

bool Bond::TypeSpecifier::IsMost32IntegerType ( ) const

Returns true if this type is at most 32-bit integer.

◆ IsNumericType()

bool Bond::TypeSpecifier::IsNumericType ( ) const

Returns true if this type is numeric.

◆ IsResolved()

bool Bond::TypeSpecifier::IsResolved ( ) const

Returns true if this type specifier has been resolved.

◆ IsStructType()

bool Bond::TypeSpecifier::IsStructType ( ) const

Returns true if this type is a struct type.

◆ IsVoidType()

bool Bond::TypeSpecifier::IsVoidType ( ) const

Returns true if this type is void.

◆ SetDefinition()

void Bond::TypeSpecifier::SetDefinition ( const Symbol * symbol)
inline

Sets the resolved symbol definition for this type.

Parameters
symbolSymbol that defines this type.

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