diff --git a/compiler/src/prog8/compiler/target/c64/C64MachineDefinition.kt b/compiler/src/prog8/compiler/target/c64/C64MachineDefinition.kt index af5aa99da..5f53595eb 100644 --- a/compiler/src/prog8/compiler/target/c64/C64MachineDefinition.kt +++ b/compiler/src/prog8/compiler/target/c64/C64MachineDefinition.kt @@ -39,7 +39,7 @@ internal object C64MachineDefinition: IMachineDefinition { for(emulator in listOf("x64sc", "x64")) { println("\nStarting C-64 emulator $emulator...") val cmdline = listOf(emulator, "-silent", "-moncommands", "$programName.vice-mon-list", - "-autostartprgmode", "1", "-autostart-warp", "-autostart", programName + ".prg") + "-autostartprgmode", "1", "-autostart-warp", "-autostart", "$programName.prg") val processb = ProcessBuilder(cmdline).inheritIO() val process: Process try { diff --git a/compiler/src/prog8/optimizer/StatementOptimizer.kt b/compiler/src/prog8/optimizer/StatementOptimizer.kt index 50703d8dc..10dff59ab 100644 --- a/compiler/src/prog8/optimizer/StatementOptimizer.kt +++ b/compiler/src/prog8/optimizer/StatementOptimizer.kt @@ -27,7 +27,11 @@ internal class StatementOptimizer(private val program: Program, override fun after(subroutine: Subroutine, parent: Node): Iterable { for(returnvar in subsThatNeedReturnVariable) { - val decl = VarDecl(VarDeclType.VAR, returnvar.second, ZeropageWish.DONTCARE, null, retvarName, null, false, true, returnvar.third) + val decl = VarDecl(VarDeclType.VAR, returnvar.second, ZeropageWish.DONTCARE, null, retvarName, null, + isArray = false, + autogeneratedDontRemove = true, + position = returnvar.third + ) returnvar.first.statements.add(0, decl) } subsThatNeedReturnVariable.clear() diff --git a/compilerAst/src/prog8/ast/AstToplevel.kt b/compilerAst/src/prog8/ast/AstToplevel.kt index 2ac43b654..40a5c940d 100644 --- a/compilerAst/src/prog8/ast/AstToplevel.kt +++ b/compilerAst/src/prog8/ast/AstToplevel.kt @@ -293,8 +293,7 @@ class Program(val name: String, ) internedStringsBlock.statements.add(decl) decl.linkParents(internedStringsBlock) - val scopedName = listOf(internedStringsModuleName, decl.name) - return scopedName + return listOf(internedStringsModuleName, decl.name) } val key = Pair(string.value, string.altEncoding) diff --git a/compilerAst/src/prog8/ast/statements/AstStatements.kt b/compilerAst/src/prog8/ast/statements/AstStatements.kt index b09cd3d02..4bdd35734 100644 --- a/compilerAst/src/prog8/ast/statements/AstStatements.kt +++ b/compilerAst/src/prog8/ast/statements/AstStatements.kt @@ -537,7 +537,7 @@ class InlineAssembly(val assembly: String, override val position: Position) : St class AnonymousScope(override var statements: MutableList, override val position: Position) : INameScope, Statement() { - override val name: String + override val name: String = "" override lateinit var parent: Node companion object { @@ -545,7 +545,7 @@ class AnonymousScope(override var statements: MutableList, } init { - name = "" // make sure it's an invalid soruce code identifier so user source code can never produce it + // make sure it's an invalid soruce code identifier so user source code can never produce it sequenceNumber++ } diff --git a/compilerAst/src/prog8/ast/walk/AstWalker.kt b/compilerAst/src/prog8/ast/walk/AstWalker.kt index fff0ba2f6..194b1f2e6 100644 --- a/compilerAst/src/prog8/ast/walk/AstWalker.kt +++ b/compilerAst/src/prog8/ast/walk/AstWalker.kt @@ -175,7 +175,7 @@ abstract class AstWalker { fun applyModifications(): Int { // check if there are double removes, keep only the last one val removals = modifications.filter { it.first is IAstModification.Remove } - if(removals.size>0) { + if(removals.isNotEmpty()) { val doubles = removals.groupBy { (it.first as IAstModification.Remove).node }.filter { it.value.size>1 } doubles.forEach { for(doubleRemove in it.value.dropLast(1)) { diff --git a/compilerAst/src/prog8/parser/ModuleParsing.kt b/compilerAst/src/prog8/parser/ModuleParsing.kt index edf695e6a..87eba5d40 100644 --- a/compilerAst/src/prog8/parser/ModuleParsing.kt +++ b/compilerAst/src/prog8/parser/ModuleParsing.kt @@ -25,7 +25,10 @@ fun moduleName(fileName: Path) = fileName.toString().substringBeforeLast('.') internal fun pathFrom(stringPath: String, vararg rest: String): Path = FileSystems.getDefault().getPath(stringPath, *rest) -class ModuleImporter(val program: Program, val encoder: IStringEncoding, val compilationTargetName: String, val libdirs: List) { +class ModuleImporter(private val program: Program, + private val encoder: IStringEncoding, + private val compilationTargetName: String, + private val libdirs: List) { fun importModule(filePath: Path): Module { print("importing '${moduleName(filePath.fileName)}'")