diff --git a/compiler/src/prog8/compiler/target/cpu6502/codegen/AsmGen.kt b/compiler/src/prog8/compiler/target/cpu6502/codegen/AsmGen.kt index f383eb1be..24e65c83c 100644 --- a/compiler/src/prog8/compiler/target/cpu6502/codegen/AsmGen.kt +++ b/compiler/src/prog8/compiler/target/cpu6502/codegen/AsmGen.kt @@ -14,6 +14,7 @@ import prog8.compiler.target.cbm.AssemblyProgram import prog8.compiler.target.cpu6502.codegen.assignment.AsmAssignment import prog8.compiler.target.cpu6502.codegen.assignment.AssignmentAsmGen import prog8.optimizer.CallGraph +import prog8.parser.SourceCode import java.nio.file.Path import java.time.LocalDate import java.time.LocalDateTime @@ -1325,7 +1326,9 @@ $repeatLabel lda $counterVar "%asminclude" -> { // TODO: handle %asminclude with SourceCode val includedName = stmt.args[0].str!! - val sourcePath = Path(stmt.definingModule.source.pathString()) // FIXME: %asminclude inside non-library, non-filesystem module + if(stmt.definingModule.source is SourceCode.Generated) + TODO("%asminclude inside non-library, non-filesystem module") + val sourcePath = Path(stmt.definingModule.source.pathString()) loadAsmIncludeFile(includedName, sourcePath).fold( success = { assemblyLines.add(it.trimEnd().trimStart('\n')) }, failure = { errors.err(it.toString(), stmt.position) } @@ -1335,7 +1338,9 @@ $repeatLabel lda $counterVar val includedName = stmt.args[0].str!! val offset = if(stmt.args.size>1) ", ${stmt.args[1].int}" else "" val length = if(stmt.args.size>2) ", ${stmt.args[2].int}" else "" - val sourcePath = Path(stmt.definingModule.source.pathString()) // FIXME: %asmbinary inside non-library, non-filesystem module + if(stmt.definingModule.source is SourceCode.Generated) + TODO("%asmbinary inside non-library, non-filesystem module") + val sourcePath = Path(stmt.definingModule.source.pathString()) val includedPath = sourcePath.resolveSibling(includedName) val pathForAssembler = outputDir // #54: 64tass needs the path *relative to the .asm file* .absolute() // avoid IllegalArgumentExc due to non-absolute path .relativize(absolute path) diff --git a/compiler/test/ModuleImporterTests.kt b/compiler/test/ModuleImporterTests.kt index 49c23c0cd..17889e9e3 100644 --- a/compiler/test/ModuleImporterTests.kt +++ b/compiler/test/ModuleImporterTests.kt @@ -303,6 +303,7 @@ class TestModuleImporter { assertThat("endCol; should be 0-based", it.position.endCol, equalTo(6)) } assertThat(program.modules.size, equalTo(2)) + importer.errors.report() } } diff --git a/compiler/test/TestCompilerOnExamples.kt b/compiler/test/TestCompilerOnExamples.kt index 352fe3154..f9d02d005 100644 --- a/compiler/test/TestCompilerOnExamples.kt +++ b/compiler/test/TestCompilerOnExamples.kt @@ -1,5 +1,6 @@ package prog8tests +import org.junit.jupiter.api.Disabled import org.junit.jupiter.api.DynamicTest import org.junit.jupiter.api.DynamicTest.dynamicTest import org.junit.jupiter.api.TestFactory diff --git a/compilerAst/test/TestProg8Parser.kt b/compilerAst/test/TestProg8Parser.kt index b5786b8a9..3a9ede625 100644 --- a/compilerAst/test/TestProg8Parser.kt +++ b/compilerAst/test/TestProg8Parser.kt @@ -344,10 +344,10 @@ class TestProg8Parser { * TODO: this test is testing way too much at once */ @Test - @Disabled("TODO: fix .position of nodes below Module - step 8, 'refactor AST gen'") + //@Disabled("TODO: fix .position of nodes below Module - step 8, 'refactor AST gen'") fun `of non-root Nodes parsed from a string`() { val srcText = """ - %target 16, "abc" ; DirectiveArg directly inherits from Node - neither an Expression nor a Statement..? + %zeropage basicsafe ; DirectiveArg directly inherits from Node - neither an Expression nor a Statement..? main { sub start() { ubyte foo = 42 diff --git a/compilerAst/test/TestSourceCode.kt b/compilerAst/test/TestSourceCode.kt index c012e031a..395ed6395 100644 --- a/compilerAst/test/TestSourceCode.kt +++ b/compilerAst/test/TestSourceCode.kt @@ -138,13 +138,4 @@ class TestSourceCode { assertFailsWith { SourceCode.Resource(pathString) } } - - @Test - @Disabled("TODO: inside resources: cannot tell apart a folder from a file") - fun testFromResourcesWithDirectory() { - val pathString = "/prog8lib" - assumeDirectory(resourcesDir, pathString.substring(1)) - assertFailsWith { SourceCode.Resource(pathString) } - } - } diff --git a/docs/source/todo.rst b/docs/source/todo.rst index f79ba3bd1..799c2b183 100644 --- a/docs/source/todo.rst +++ b/docs/source/todo.rst @@ -3,7 +3,9 @@ TODO For next compiler release ^^^^^^^^^^^^^^^^^^^^^^^^^ -- can we derive module.name from module.source (taking just the filename base)? +- fix "unknown" reported in resulting .asm as source file of included library modules/resources + unittest: "of non-root Nodes parsed from a string" + Blocked by Commander-x16 v39 release @@ -14,6 +16,7 @@ Blocked by Commander-x16 v39 release Future ^^^^^^ +- derive module.name from module.source (taking just the filename base)? - get rid of all TODO's and FIXME's in the code - improve testability further, add more tests, address more questions/issues from the testability discussions. - can we get rid of pieces of asmgen.AssignmentAsmGen by just reusing the AugmentableAssignment ? generated code should not suffer