sun::types::FunctionType
class · Source (opens in a new tab)
class sun::types::FunctionType : public sun::types::TypeA non-null, one-word pointer to a module-scope function.
Type annotation: function (Args) Result
Inherits
- sun::types::Type (public)
Public Functions
- FunctionType
- canThrow
- equals
- getKind
- getParamTypes
- getReturnType
- requiresUnsafe
- setCanThrow
- toDisplayString
- toLLVMClosureType
- toLLVMFunctionType
- toLLVMType
- toPointerType
- toString
FunctionType
public · function · Source (opens in a new tab)
sun::types::FunctionType::FunctionType(TypePtr ret, std::vector< TypePtr > params, bool canThrow=false, bool requiresUnsafe=false)Creates a function type from its result, parameters, and calling restrictions.
Related: TypePtr
canThrow
public · function · Source (opens in a new tab)
bool sun::types::FunctionType::canThrow() constWhether calls through this pointer may throw.
equals
public · function · Source (opens in a new tab)
bool sun::types::FunctionType::equals(const Type &other) const overrideReports whether the other type has the same semantic identity.
Related: Type
getKind
public · function · Source (opens in a new tab)
Kind sun::types::FunctionType::getKind() const overrideReturns the type category used for semantic checks and dispatch.
Related: Kind
getParamTypes
public · function · Source (opens in a new tab)
const std::vector< TypePtr > & sun::types::FunctionType::getParamTypes() constProvides the ordered semantic types of the function parameters.
Related: TypePtr
getReturnType
public · function · Source (opens in a new tab)
const TypePtr & sun::types::FunctionType::getReturnType() constReturns the semantic type of the function result.
Related: TypePtr
requiresUnsafe
public · function · Source (opens in a new tab)
bool sun::types::FunctionType::requiresUnsafe() constWhether calling this value requires an unsafe block.
setCanThrow
public · function · Source (opens in a new tab)
void sun::types::FunctionType::setCanThrow(bool v)Records whether calls through this signature may throw an error.
toDisplayString
public · function · Source (opens in a new tab)
std::string sun::types::FunctionType::toDisplayString() const overrideReturns a source-facing type name without internal compiler prefixes.
toLLVMClosureType
public · function · Source (opens in a new tab)
llvm::StructType * sun::types::FunctionType::toLLVMClosureType(llvm::LLVMContext &ctx) constGet the closure struct type { ptr, ptr } (func*, env*).
toLLVMFunctionType
public · function · Source (opens in a new tab)
llvm::FunctionType * sun::types::FunctionType::toLLVMFunctionType(llvm::LLVMContext &ctx) constGet the raw LLVM FunctionType (for indirect calls).
Related: FunctionType
toLLVMType
public · function · Source (opens in a new tab)
llvm::Type * sun::types::FunctionType::toLLVMType(llvm::LLVMContext &ctx) const overrideFunction values use LLVM's opaque pointer representation.
toPointerType
public · function · Source (opens in a new tab)
llvm::Type * sun::types::FunctionType::toPointerType(llvm::LLVMContext &ctx) constReturns a pointer to the function type (for function pointer variables).
toString
public · function · Source (opens in a new tab)
std::string sun::types::FunctionType::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::FunctionType::StaticKind = Kind::FunctionNo documentation comment.
Related: Kind, Kind::Function
Private Fields
canThrow_
private · variable · Source (opens in a new tab)
bool sun::types::FunctionType::canThrow_ = falseNo documentation comment.
paramTypes
private · variable · Source (opens in a new tab)
std::vector<TypePtr> sun::types::FunctionType::paramTypesNo documentation comment.
Related: TypePtr
requiresUnsafe_
private · variable · Source (opens in a new tab)
bool sun::types::FunctionType::requiresUnsafe_ = falseNo documentation comment.
returnType
private · variable · Source (opens in a new tab)
TypePtr sun::types::FunctionType::returnTypeNo documentation comment.
Related: TypePtr