sun::types::ReferenceType
class · Source (opens in a new tab)
class sun::types::ReferenceType : public sun::types::TypeReference type - behaves like a pointer but with implicit dereferencing Type annotation: ref(T) where T is the referenced type Examples: ref(i32) = reference to i32 When reading a reference, it automatically dereferences When assigning to a reference, it stores to the underlying address.
Inherits
- sun::types::Type (public)
Public Functions
- ReferenceType
- equals
- getClassLifetimeArgs
- getKind
- getLifetimeName
- getReferencedLLVMType
- getReferencedType
- isMutable
- isUnsizedArrayRef
- setClassLifetimeArgs
- setLifetimeName
- toDisplayString
- toLLVMType
- toString
ReferenceType
public · function · Source (opens in a new tab)
sun::types::ReferenceType::ReferenceType(TypePtr referenced, bool isMutable=true)Creates a borrowed reference type with the requested mutability.
Related: TypePtr
equals
public · function · Source (opens in a new tab)
bool sun::types::ReferenceType::equals(const Type &other) const overrideReports whether the other type has the same semantic identity.
Related: Type
getClassLifetimeArgs
public · function · Source (opens in a new tab)
const std::vector< std::string > & sun::types::ReferenceType::getClassLifetimeArgs() constLifetime arguments applied to the referent's class ('ref Bus<'this>'): positionally binding the class's declared lifetimes.
Metadata like lifetimeName_ - never part of the type's identity.
getKind
public · function · Source (opens in a new tab)
Kind sun::types::ReferenceType::getKind() const overrideReturns the type category used for semantic checks and dispatch.
Related: Kind
getLifetimeName
public · function · Source (opens in a new tab)
const std::string & sun::types::ReferenceType::getLifetimeName() constReturns the named lifetime associated with the borrowed value.
getReferencedLLVMType
public · function · Source (opens in a new tab)
llvm::Type * sun::types::ReferenceType::getReferencedLLVMType(llvm::LLVMContext &ctx) constGet the LLVM type of the referenced value (for load/store operations).
getReferencedType
public · function · Source (opens in a new tab)
const TypePtr & sun::types::ReferenceType::getReferencedType() constReturns the referenced type stored by this object.
Related: TypePtr
isMutable
public · function · Source (opens in a new tab)
bool sun::types::ReferenceType::isMutable() constReports whether the loan grants exclusive write access to its target.
isUnsizedArrayRef
public · function · Source (opens in a new tab)
bool sun::types::ReferenceType::isUnsizedArrayRef() constCheck if this is a reference to an unsized array.
setClassLifetimeArgs
public · function · Source (opens in a new tab)
void sun::types::ReferenceType::setClassLifetimeArgs(std::vector< std::string > args)Updates the lifetime arguments for the referenced class.
setLifetimeName
public · function · Source (opens in a new tab)
void sun::types::ReferenceType::setLifetimeName(std::string name)Assigns the named lifetime associated with the borrowed value.
toDisplayString
public · function · Source (opens in a new tab)
std::string sun::types::ReferenceType::toDisplayString() const overrideReturns a source-facing type name without internal compiler prefixes.
toLLVMType
public · function · Source (opens in a new tab)
llvm::Type * sun::types::ReferenceType::toLLVMType(llvm::LLVMContext &ctx) const overrideReturns opaque pointer or fat pointer struct for unsized array refs.
toString
public · function · Source (opens in a new tab)
std::string sun::types::ReferenceType::toString() const overrideReturns a readable representation for diagnostics and debugging.
Public Fields
StaticKind
public · variable · static · Source (opens in a new tab)
Kind sun::types::ReferenceType::StaticKind = Kind::ReferenceNo documentation comment.
Related: Kind, Kind::Reference
Private Fields
classLifetimeArgs_
private · variable · Source (opens in a new tab)
std::vector<std::string> sun::types::ReferenceType::classLifetimeArgs_No documentation comment.
lifetimeName_
private · variable · Source (opens in a new tab)
std::string sun::types::ReferenceType::lifetimeName_No documentation comment.
mutable_
private · variable · Source (opens in a new tab)
bool sun::types::ReferenceType::mutable_No documentation comment.
referencedType
private · variable · Source (opens in a new tab)
TypePtr sun::types::ReferenceType::referencedTypeNo documentation comment.
Related: TypePtr