sun::types::LambdaType
class · Source (opens in a new tab)
class sun::types::LambdaType : public sun::types::TypeLambda type for anonymous functions (fat pointer call, returnable) Type annotation: () => {}.
Inherits
- sun::types::Type (public)
Public Functions
- LambdaType
- acceptsValueOf
- canThrow
- equals
- equalsIgnoringThrow
- getKind
- getLifetimeName
- getParamTypes
- getReturnType
- hasRefCaptures
- requiresUnsafe
- setHasRefCaptures
- setLifetimeName
- toDisplayString
- toLLVMFunctionType
- toLLVMType
- toString
LambdaType
public · function · Source (opens in a new tab)
sun::types::LambdaType::LambdaType(TypePtr ret, std::vector< TypePtr > params, bool canThrow=false, bool requiresUnsafe=false)Creates a captured-callable type from its result, parameters, and restrictions.
Related: TypePtr
acceptsValueOf
public · function · Source (opens in a new tab)
bool sun::types::LambdaType::acceptsValueOf(const LambdaType &from) constCan a by-value 'from' argument bind to a parameter of this type?
Same signature, and each marker only widens: a non-throwing lambda may go where a throwing one is expected, and an environment-free lambda may go where a '<'_>' one is expected — never the other way around.
Related: LambdaType
canThrow
public · function · Source (opens in a new tab)
bool sun::types::LambdaType::canThrow() constReports whether calls through this type may produce an error.
equals
public · function · Source (opens in a new tab)
bool sun::types::LambdaType::equals(const Type &other) const overrideReports whether the other type has the same semantic identity.
Related: Type
equalsIgnoringThrow
public · function · Source (opens in a new tab)
bool sun::types::LambdaType::equalsIgnoringThrow(const LambdaType &other) constSame signature ignoring throwing-ness and the lifetime marker.
Used by the bound-method overload chooser, which picks a method by shape before the chosen value is flagged as frame-bound; assignability rejects it later.
Related: LambdaType
getKind
public · function · Source (opens in a new tab)
Kind sun::types::LambdaType::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::LambdaType::getLifetimeName() constReturns the named lifetime associated with the borrowed value.
getParamTypes
public · function · Source (opens in a new tab)
const std::vector< TypePtr > & sun::types::LambdaType::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::LambdaType::getReturnType() constReturns the semantic type of the function result.
Related: TypePtr
hasRefCaptures
public · function · Source (opens in a new tab)
bool sun::types::LambdaType::hasRefCaptures() constReports whether this object has ref captures.
requiresUnsafe
public · function · Source (opens in a new tab)
bool sun::types::LambdaType::requiresUnsafe() constWhether calling this value requires an unsafe block.
setHasRefCaptures
public · function · Source (opens in a new tab)
void sun::types::LambdaType::setHasRefCaptures(bool v)Records whether the callable retains any borrowed captures.
setLifetimeName
public · function · Source (opens in a new tab)
void sun::types::LambdaType::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::LambdaType::toDisplayString() const overrideReturns a source-facing type name without internal compiler prefixes.
toLLVMFunctionType
public · function · Source (opens in a new tab)
llvm::FunctionType * sun::types::LambdaType::toLLVMFunctionType(llvm::LLVMContext &ctx) constGet the raw LLVM FunctionType (for the actual function signature with closure param).
Related: FunctionType
toLLVMType
public · function · Source (opens in a new tab)
llvm::Type * sun::types::LambdaType::toLLVMType(llvm::LLVMContext &ctx) const overrideReturns the closure struct type { ptr, ptr } (func*, env*).
toString
public · function · Source (opens in a new tab)
std::string sun::types::LambdaType::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::LambdaType::StaticKind = Kind::LambdaNo documentation comment.
Related: Kind, Kind::Lambda
Private Fields
canThrow_
private · variable · Source (opens in a new tab)
bool sun::types::LambdaType::canThrow_ = falseNo documentation comment.
hasRefCaptures_
private · variable · Source (opens in a new tab)
bool sun::types::LambdaType::hasRefCaptures_ = falseNo documentation comment.
lifetimeName_
private · variable · Source (opens in a new tab)
std::string sun::types::LambdaType::lifetimeName_No documentation comment.
paramTypes
private · variable · Source (opens in a new tab)
std::vector<TypePtr> sun::types::LambdaType::paramTypesNo documentation comment.
Related: TypePtr
requiresUnsafe_
private · variable · Source (opens in a new tab)
bool sun::types::LambdaType::requiresUnsafe_ = falseNo documentation comment.
returnType
private · variable · Source (opens in a new tab)
TypePtr sun::types::LambdaType::returnTypeNo documentation comment.
Related: TypePtr