fix ast error on inline sub

This commit is contained in:
Irmen de Jong 2023-02-14 22:37:33 +01:00
parent 0cbc56b82e
commit db794752cb
2 changed files with 4 additions and 4 deletions

View File

@ -326,8 +326,8 @@ class IntermediateAstMaker(private val program: Program, private val options: Co
var returntype = srcSub.returntypes.singleOrNull()
if(returntype==DataType.STR)
returntype=DataType.UWORD // if a sub returns 'str', replace with uword. Intermediate AST and I.R. don't contain 'str' datatype anymore.
if(srcSub.inline)
throw FatalAstException("non-asm subs cannot be inline")
// do not bother about the 'inline' hint of the source subroutine.
val sub = PtSub(srcSub.name,
srcSub.parameters.map { PtSubroutineParameter(it.name, it.type, it.position) },
returntype,

View File

@ -188,8 +188,8 @@ class TestCompilerOnExamplesVirtual: FunSpec({
val (displayName, filepath) = prepareTestFiles(it, false, target)
test(displayName) {
val src = filepath.readText()
compileText(target, false, src, writeAssembly = true) shouldNotBe null
compileText(target, false, src, writeAssembly = true) shouldNotBe null
compileText(target, true, src, writeAssembly = true) shouldNotBe null
compileText(target, true, src, writeAssembly = true) shouldNotBe null
}
}
})