cleanup some compilation warnings

This commit is contained in:
Irmen de Jong 2023-07-22 23:44:26 +02:00
parent 7cf6aba625
commit fea297e409
8 changed files with 3 additions and 13 deletions

View File

@ -126,7 +126,6 @@ fun printAst(root: PtNode, skipLibraries: Boolean, output: (text: String) -> Uni
else
"->"
}
else -> throw InternalCompilerException("unrecognised ast node $node")
}
}

View File

@ -40,7 +40,6 @@ class CX16Zeropage(options: CompilationOptions) : Zeropage(options) {
ZeropageType.DONTUSE -> {
free.clear() // don't use zeropage at all
}
else -> throw InternalCompilerException("for this machine target, zero page type 'floatsafe' is not available. ${options.zeropage}")
}
val distinctFree = free.distinct()

View File

@ -32,7 +32,7 @@ internal class AnyExprAsmGen(
require(expr.left.type in WordDatatypes && expr.right.type in WordDatatypes) {
"both operands must be words"
}
return assignWordBinExpr(expr, assign)
return assignWordBinExpr(expr)
}
DataType.FLOAT -> {
require(expr.left.type==DataType.FLOAT && expr.right.type==DataType.FLOAT) {
@ -44,7 +44,7 @@ internal class AnyExprAsmGen(
}
}
private fun assignWordBinExpr(expr: PtBinaryExpression, assign: AsmAssignment): Boolean {
private fun assignWordBinExpr(expr: PtBinaryExpression): Boolean {
when(expr.operator) {
"+" -> {
TODO("word + at ${expr.position}")
@ -253,7 +253,6 @@ internal class AnyExprAsmGen(
}
else -> TODO("float expression operator ${expr.operator}")
}
return false
}
private fun setupFloatComparisonFAC1vsVarAY(expr: PtBinaryExpression) {

View File

@ -3376,7 +3376,6 @@ internal class AssignmentAsmGen(private val program: PtProgram,
}
}
TargetStorageKind.ARRAY -> assignPrefixedExpressionToArrayElt(makePrefixedExprFromArrayExprAssign("~", assign), scope)
else -> throw AssemblyError("weird target")
}
}
DataType.UWORD -> {
@ -3442,7 +3441,6 @@ internal class AssignmentAsmGen(private val program: PtProgram,
}
TargetStorageKind.MEMORY -> throw AssemblyError("memory is ubyte, can't negate that")
TargetStorageKind.ARRAY -> assignPrefixedExpressionToArrayElt(makePrefixedExprFromArrayExprAssign("-", assign), scope)
else -> throw AssemblyError("weird target")
}
}
DataType.WORD -> {
@ -3501,7 +3499,6 @@ internal class AssignmentAsmGen(private val program: PtProgram,
}
TargetStorageKind.MEMORY -> throw AssemblyError("memory is ubyte, can't negate that")
TargetStorageKind.ARRAY -> assignPrefixedExpressionToArrayElt(makePrefixedExprFromArrayExprAssign("-", assign), scope)
else -> throw AssemblyError("weird target")
}
}
DataType.FLOAT -> {

View File

@ -110,7 +110,6 @@ class IRFileWriter(private val irProgram: IRProgram, outfileOverride: Path?) {
is IRInlineAsmChunk -> writeInlineAsm(chunk)
is IRInlineBinaryChunk -> writeInlineBytes(chunk)
is IRCodeChunk -> writeCodeChunk(chunk)
else -> throw InternalCompilerException("invalid chunk")
}
}
xml.writeEndElement()

View File

@ -168,7 +168,6 @@ class IRProgram(val name: String,
}
}
is IRInlineBinaryChunk -> { }
else -> throw AssemblyError("invalid chunk")
}
}
}

View File

@ -1,6 +1,5 @@
package prog8.vm
import prog8.code.core.AssemblyError
import prog8.intermediate.FunctionCallArgs
import prog8.intermediate.IRDataType
import kotlin.math.*
@ -484,7 +483,6 @@ object SysCalls {
val result = floor(radians/2.0/PI*256.0)
returnValue(callspec.returns!!, result, vm)
}
else -> throw AssemblyError("missing syscall ${call.name}")
}
}
}

View File

@ -173,7 +173,7 @@ class VmProgramLoader {
subroutines.forEach {
it.value.chunks.forEach { chunk ->
chunk.instructions.withIndex().forEach { (index, ins) ->
chunk.instructions.withIndex().forEach { (_, ins) ->
if(ins.opcode==Opcode.CALL) {
val fcallspec = ins.fcallArgs!!
val argsWithAddresses = fcallspec.arguments.map { arg ->