added symboltable into CompilationResult because it might be useful to inspect in tests

This commit is contained in:
Irmen de Jong
2025-10-07 00:26:43 +02:00
parent f7639cb78f
commit f4f34fc2ed
2 changed files with 14 additions and 6 deletions

View File

@@ -8,6 +8,7 @@ import io.kotest.matchers.shouldNotBe
import io.kotest.matchers.string.shouldContain
import io.kotest.matchers.string.shouldStartWith
import io.kotest.matchers.types.instanceOf
import prog8.code.StNodeType
import prog8.code.ast.*
import prog8.code.core.BaseDataType
import prog8.code.core.DataType
@@ -81,6 +82,12 @@ main {
val assign = start.children[2] as PtAssignment
assign.target.identifier!!.name shouldBe "cx16.r0"
assign.value shouldBe instanceOf<PtBinaryExpression>()
val st = result.codegenSymboltable!!
st.flat.size shouldBeGreaterThan 100
st.flat["cbm.CHROUT"]?.type shouldBe StNodeType.EXTSUB
st.lookup("cbm.CHROUT")?.type shouldBe StNodeType.EXTSUB
st.lookupUnscoped("sizeof")?.type shouldBe StNodeType.BUILTINFUNC
}
test("peek and poke argument types") {