sun::ast::TypeAnnotation

sun::ast::TypeAnnotation

struct · Source (opens in a new tab)

struct sun::ast::TypeAnnotation

Type annotation structure for parsed type info Supports: i32, f64, bool, void, ptr<T>, ref T, function, lambda Generic types: ClassName<T, U> for class instantiation Array types: array<T, N> or array<T, M, N> for fixed-size arrays Error union types: T, error (value or error).

Public Functions

TypeAnnotation

TypeAnnotation(const TypeAnnotation &other)

public · function · Source (opens in a new tab)

sun::ast::TypeAnnotation::TypeAnnotation(const TypeAnnotation &other)

Creates a type annotation from a name or an existing annotation.

TypeAnnotation(TypeAnnotation &&)=default

public · function · Source (opens in a new tab)

sun::ast::TypeAnnotation::TypeAnnotation(TypeAnnotation &&)=default

Creates a type annotation from a name or an existing annotation.

TypeAnnotation()=default

public · function · Source (opens in a new tab)

sun::ast::TypeAnnotation::TypeAnnotation()=default

Creates a type annotation from a name or an existing annotation.

TypeAnnotation(std::string name)

public · function · Source (opens in a new tab)

sun::ast::TypeAnnotation::TypeAnnotation(std::string name)

Creates a type annotation from a name or an existing annotation.

isAnonymousFrameLambda

public · function · Source (opens in a new tab)

bool sun::ast::TypeAnnotation::isAnonymousFrameLambda() const

Reports whether this is a <'_> lambda type whose frame has no name: written <'_> or with no lifetime at all.

Such a type cannot be returned, because its environment dies with the frame that made it.

isArray

public · function · Source (opens in a new tab)

bool sun::ast::TypeAnnotation::isArray() const

Reports whether this syntax node represents an array annotation.

isCallable

public · function · Source (opens in a new tab)

bool sun::ast::TypeAnnotation::isCallable() const

Reports whether this value can be invoked as a function.

isConstReference

public · function · Source (opens in a new tab)

bool sun::ast::TypeAnnotation::isConstReference() const

Reports whether this syntax node represents a reference without write access.

isErrorUnion

public · function · Source (opens in a new tab)

bool sun::ast::TypeAnnotation::isErrorUnion() const

Reports whether this syntax node represents a value-or-error type.

isFunction

public · function · Source (opens in a new tab)

bool sun::ast::TypeAnnotation::isFunction() const

Reports whether this syntax node represents a function definition.

isGeneric

public · function · Source (opens in a new tab)

bool sun::ast::TypeAnnotation::isGeneric() const

Reports whether this declaration still has unbound type parameters.

isLambda

public · function · Source (opens in a new tab)

bool sun::ast::TypeAnnotation::isLambda() const

Reports whether this syntax node represents a lambda expression.

isRawPointer

public · function · Source (opens in a new tab)

bool sun::ast::TypeAnnotation::isRawPointer() const

Reports whether this syntax node represents a raw-pointer annotation.

isReference

public · function · Source (opens in a new tab)

bool sun::ast::TypeAnnotation::isReference() const

Reports whether this syntax node represents a borrowed-reference annotation.

isStaticPointer

public · function · Source (opens in a new tab)

bool sun::ast::TypeAnnotation::isStaticPointer() const

Reports whether this syntax node represents a static-pointer annotation.

operator=

operator=(TypeAnnotation &&)=default

public · function · Source (opens in a new tab)

TypeAnnotation & sun::ast::TypeAnnotation::operator=(TypeAnnotation &&)=default

Transfers the stored state from another instance during move assignment.

Related: TypeAnnotation

operator=(const TypeAnnotation &other)

public · function · Source (opens in a new tab)

TypeAnnotation & sun::ast::TypeAnnotation::operator=(const TypeAnnotation &other)

Replaces the stored state with a copy of another instance.

Related: TypeAnnotation

operator==

public · function · Source (opens in a new tab)

bool sun::ast::TypeAnnotation::operator==(const TypeAnnotation &other) const

Compare type structure and resolved names, ignoring source locations.

Related: TypeAnnotation

toString

public · function · Source (opens in a new tab)

std::string sun::ast::TypeAnnotation::toString() const

Returns a readable representation for diagnostics and debugging.

Public Fields

arrayDimensions

public · variable · Source (opens in a new tab)

std::vector<ArrayDimension> sun::ast::TypeAnnotation::arrayDimensions

No documentation comment.

Related: ArrayDimension

baseName

public · variable · Source (opens in a new tab)

std::string sun::ast::TypeAnnotation::baseName

No documentation comment.

canError

public · variable · Source (opens in a new tab)

bool sun::ast::TypeAnnotation::canError = false

No documentation comment.

constRef

public · variable · Source (opens in a new tab)

bool sun::ast::TypeAnnotation::constRef = false

No documentation comment.

declarationKey

public · variable · Source (opens in a new tab)

std::optional<sun::semantic_analysis::PortableDeclarationKey> sun::ast::TypeAnnotation::declarationKey

No documentation comment.

Related: sun::semantic_analysis::PortableDeclarationKey

elementType

public · variable · Source (opens in a new tab)

std::unique_ptr<TypeAnnotation> sun::ast::TypeAnnotation::elementType

No documentation comment.

Related: TypeAnnotation

lifetimeArguments

public · variable · Source (opens in a new tab)

std::vector<std::string> sun::ast::TypeAnnotation::lifetimeArguments

No documentation comment.

lifetimeName

public · variable · Source (opens in a new tab)

std::string sun::ast::TypeAnnotation::lifetimeName

No documentation comment.

paramTypes

public · variable · Source (opens in a new tab)

std::vector<std::unique_ptr<TypeAnnotation> > sun::ast::TypeAnnotation::paramTypes

No documentation comment.

Related: TypeAnnotation

refEnv

public · variable · Source (opens in a new tab)

bool sun::ast::TypeAnnotation::refEnv = false

No documentation comment.

requiresUnsafe

public · variable · Source (opens in a new tab)

bool sun::ast::TypeAnnotation::requiresUnsafe = false

No documentation comment.

returnType

public · variable · Source (opens in a new tab)

std::unique_ptr<TypeAnnotation> sun::ast::TypeAnnotation::returnType

No documentation comment.

Related: TypeAnnotation

span

public · variable · Source (opens in a new tab)

sun::support::Position sun::ast::TypeAnnotation::span {}

No documentation comment.

Related: sun::support::Position

typeArguments

public · variable · Source (opens in a new tab)

std::vector<std::unique_ptr<TypeAnnotation> > sun::ast::TypeAnnotation::typeArguments

No documentation comment.

Related: TypeAnnotation