From db794752cbc85b00f5775e3f738362a819e52d1d Mon Sep 17 00:00:00 2001 From: Irmen de Jong Date: Tue, 14 Feb 2023 22:37:33 +0100 Subject: [PATCH] fix ast error on inline sub --- .../src/prog8/compiler/astprocessing/IntermediateAstMaker.kt | 4 ++-- compiler/test/TestCompilerOnExamples.kt | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/compiler/src/prog8/compiler/astprocessing/IntermediateAstMaker.kt b/compiler/src/prog8/compiler/astprocessing/IntermediateAstMaker.kt index 0c8f5cfe7..d610667a1 100644 --- a/compiler/src/prog8/compiler/astprocessing/IntermediateAstMaker.kt +++ b/compiler/src/prog8/compiler/astprocessing/IntermediateAstMaker.kt @@ -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, diff --git a/compiler/test/TestCompilerOnExamples.kt b/compiler/test/TestCompilerOnExamples.kt index 1ac5fd6c9..83232ca54 100644 --- a/compiler/test/TestCompilerOnExamples.kt +++ b/compiler/test/TestCompilerOnExamples.kt @@ -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 } } })