sun::codegen::enums::EnumGenerator

sun::codegen::enums::EnumGenerator

class · Source (opens in a new tab)

class sun::codegen::enums::EnumGenerator

Emits enum definitions, variants, matches, and payload cleanup.

Public Functions

EnumGenerator

EnumGenerator(sun::codegen::CodegenState &state, sun::codegen::CodegenVisitor &gen)

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

sun::codegen::enums::EnumGenerator::EnumGenerator(sun::codegen::CodegenState &state, sun::codegen::CodegenVisitor &gen)

Uses the shared state and services of the enclosing code generator.

Related: sun::codegen::CodegenState, sun::codegen::CodegenVisitor

EnumGenerator(const EnumGenerator &)=delete

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

sun::codegen::enums::EnumGenerator::EnumGenerator(const EnumGenerator &)=delete

Disallows copying so the owned state cannot be duplicated.

codegen

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

Value * sun::codegen::enums::EnumGenerator::codegen(const sun::ast::EnumDefinitionAST &expr)

Prepares enum layouts, including generic specializations.

Related: sun::ast::EnumDefinitionAST

codegenMatch

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

Value * sun::codegen::enums::EnumGenerator::codegenMatch(const sun::ast::MatchExprAST &expr, EnumType &enumType)

Matches the enum tag and emits the selected arm's payload bindings.

Related: sun::ast::MatchExprAST, EnumType

codegenVariantAccess

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

Value * sun::codegen::enums::EnumGenerator::codegenVariantAccess(EnumType &enumType, const sun::types::EnumVariant &variant)

Emits a payload-free variant or a unit variant of a payload enum.

Related: EnumType, sun::types::EnumVariant

codegenVariantConstruction

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

Value * sun::codegen::enums::EnumGenerator::codegenVariantConstruction(const sun::ast::CallExprAST &expr, EnumType &enumType, const sun::types::EnumVariant &variant)

Constructs a variant and transfers its arguments into payload storage.

Related: sun::ast::CallExprAST, EnumType, sun::types::EnumVariant

emitDrop

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

void sun::codegen::enums::EnumGenerator::emitDrop(EnumType &enumType, llvm::Value *storagePtr)

Drops owned payloads and invalidates the enum's storage.

Related: EnumType

operator=

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

EnumGenerator & sun::codegen::enums::EnumGenerator::operator=(const EnumGenerator &)=delete

Disallows assignment so ownership and object identity cannot be duplicated.

Related: EnumGenerator

Private Functions

getOrCreateDropFunction

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

Function * sun::codegen::enums::EnumGenerator::getOrCreateDropFunction(EnumType &enumType)

Returns the enum cleanup function, generating it when first needed.

Related: EnumType

scopes

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

sun::codegen::scopes::ScopeManager & sun::codegen::enums::EnumGenerator::scopes()

Provides the scope manager responsible for variable storage and cleanup.

Related: sun::codegen::scopes::ScopeManager

Private Fields

ctx

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

sun::codegen::CodegenContext& sun::codegen::enums::EnumGenerator::ctx

No documentation comment.

Related: sun::codegen::CodegenContext

gen_

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

sun::codegen::CodegenVisitor& sun::codegen::enums::EnumGenerator::gen_

No documentation comment.

Related: sun::codegen::CodegenVisitor

state_

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

sun::codegen::CodegenState& sun::codegen::enums::EnumGenerator::state_

No documentation comment.

Related: sun::codegen::CodegenState

typeResolver

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

sun::codegen::LLVMTypeResolver& sun::codegen::enums::EnumGenerator::typeResolver

No documentation comment.

Related: sun::codegen::LLVMTypeResolver