rework some bits of the compiler to work more appropriately

This commit is contained in:
Alex Zenla
2025-07-16 23:14:25 -07:00
parent 17b1aa44c0
commit a48fac4581
8 changed files with 27 additions and 6 deletions

View File

@ -46,7 +46,11 @@ class CompilableSymbol(val compilableSlab: CompilableSlab, val scopeSymbol: Scop
}
val type = if (what is NativeFunctionDescriptor) {
IrDefinitionType.NativeFunction
} else IrDefinitionType.CodeFunction
} else if (scopeSymbol.definition is LetDefinition) {
IrDefinitionType.Variable
} else {
IrDefinitionType.CodeFunction
}
val irCodeElement = irCodeEmitter.visit(what)
val irCodeBlock = if (irCodeElement is IrCodeBlock) {
irCodeElement

View File

@ -42,7 +42,9 @@ class Compiler(val world: World) {
}
}
fun compileIrWorld(): IrWorld {
fun compileIrWorld(entryPointSymbol: CompilableSymbol): IrWorld {
val usedSymbolSet = mutableSetOf<CompilableSymbol>()
contributeCompiledSymbols(usedSymbolSet, entryPointSymbol.scopeSymbol, entryPointSymbol)
val slabs = mutableListOf<IrSlab>()
for (slab in world.slabs) {
slabs.add(compilableSlabs.of(slab).compiledIrSlab)