From ca63051c71682acd43d0c45d5d5d360a58644b93 Mon Sep 17 00:00:00 2001 From: Irmen de Jong Date: Mon, 23 Mar 2020 13:00:44 +0100 Subject: [PATCH] replaced todo's that aren't real todo's with regular exception --- .../compiler/target/c64/codegen/AsmGen.kt | 2 +- .../target/c64/codegen/AssignmentAsmGen.kt | 39 +++++++++---------- .../target/c64/codegen/ExpressionsAsmGen.kt | 2 +- 3 files changed, 21 insertions(+), 22 deletions(-) diff --git a/compiler/src/prog8/compiler/target/c64/codegen/AsmGen.kt b/compiler/src/prog8/compiler/target/c64/codegen/AsmGen.kt index 75ada9b43..a7a3f90d3 100644 --- a/compiler/src/prog8/compiler/target/c64/codegen/AsmGen.kt +++ b/compiler/src/prog8/compiler/target/c64/codegen/AsmGen.kt @@ -645,7 +645,7 @@ internal class AsmGen(private val program: Program, is BuiltinFunctionStatementPlaceholder -> throw AssemblyError("builtin function should not have placeholder anymore?") is AnonymousScope -> translate(stmt) is Block -> throw AssemblyError("block should have been handled elsewhere") - else -> TODO("no translation for $stmt") + else -> throw AssemblyError("missing asm translation for $stmt") } } diff --git a/compiler/src/prog8/compiler/target/c64/codegen/AssignmentAsmGen.kt b/compiler/src/prog8/compiler/target/c64/codegen/AssignmentAsmGen.kt index 71ac2eb05..e19332d13 100644 --- a/compiler/src/prog8/compiler/target/c64/codegen/AssignmentAsmGen.kt +++ b/compiler/src/prog8/compiler/target/c64/codegen/AssignmentAsmGen.kt @@ -58,8 +58,7 @@ internal class AssignmentAsmGen(private val program: Program, private val asmgen assignFromMemoryByte(assign.target, null, read.addressExpression as IdentifierReference) } else -> { - asmgen.translateExpression(read.addressExpression) - TODO("read memory byte from result and put that in ${assign.target}") + throw AssemblyError("missing asm gen for memread assignment into ${assign.target}") } } } @@ -117,7 +116,7 @@ internal class AssignmentAsmGen(private val program: Program, private val asmgen asmgen.translateExpression(assign.value as FunctionCall) assignFromEvalResult(assign.target) } - is ArrayLiteralValue, is StringLiteralValue -> TODO("string/array/struct assignment? $assign") + is ArrayLiteralValue, is StringLiteralValue -> throw AssemblyError("no asm gen for string/array assignment $assign") is StructLiteralValue -> throw AssemblyError("struct literal value assignment should have been flattened ${assign.value.position}") is RangeExpr -> throw AssemblyError("range expression should have been changed into array values ${assign.value.position}") } @@ -199,14 +198,14 @@ internal class AssignmentAsmGen(private val program: Program, private val asmgen """) } target.memoryAddress!=null -> { - TODO("assign address $sourceName to memory word $target") + throw AssemblyError("no asm gen for assign address $sourceName to memory word $target") } targetArrayIdx!=null -> { val index = targetArrayIdx.arrayspec.index val targetName = asmgen.asmIdentifierName(targetArrayIdx.identifier) - TODO("assign address $sourceName to array $targetName [ $index ]") + throw AssemblyError("no asm gen for assign address $sourceName to array $targetName [ $index ]") } - else -> TODO("assign address $sourceName to $target") + else -> throw AssemblyError("no asm gen for assign address $sourceName to $target") } } @@ -225,7 +224,7 @@ internal class AssignmentAsmGen(private val program: Program, private val asmgen """) } target.memoryAddress!=null -> { - TODO("assign wordvar $sourceName to memory ${target.memoryAddress}") + throw AssemblyError("no asm gen for assign wordvar $sourceName to memory ${target.memoryAddress}") } targetArrayIdx!=null -> { val index = targetArrayIdx.arrayspec.index @@ -236,7 +235,7 @@ internal class AssignmentAsmGen(private val program: Program, private val asmgen val arrayDt = targetArrayIdx.identifier.inferType(program).typeOrElse(DataType.STRUCT) popAndWriteArrayvalueWithIndexA(arrayDt, targetName) } - else -> TODO("assign wordvar to $target") + else -> throw AssemblyError("no asm gen for assign wordvar to $target") } } @@ -267,7 +266,7 @@ internal class AssignmentAsmGen(private val program: Program, private val asmgen asmgen.translateExpression(index) asmgen.out(" lda #<$targetName | ldy #>$targetName | jsr c64flt.pop_float_to_indexed_var") } - else -> TODO("assign floatvar to $target") + else -> throw AssemblyError("no asm gen for assign floatvar to $target") } } @@ -318,7 +317,7 @@ internal class AssignmentAsmGen(private val program: Program, private val asmgen } } } - else -> TODO("assign bytevar to $target") + else -> throw AssemblyError("no asm gen for assign bytevar to $target") } } @@ -413,7 +412,7 @@ internal class AssignmentAsmGen(private val program: Program, private val asmgen } } } - else -> TODO("assign register $register to $target") + else -> throw AssemblyError("no asm gen for assign register $register to $target") } } @@ -498,7 +497,7 @@ internal class AssignmentAsmGen(private val program: Program, private val asmgen } } target.memoryAddress!=null -> { - TODO("assign word $word to memory ${target.memoryAddress}") + throw AssemblyError("no asm gen for assign word $word to memory ${target.memoryAddress}") } targetArrayIdx!=null -> { val index = targetArrayIdx.arrayspec.index @@ -516,7 +515,7 @@ internal class AssignmentAsmGen(private val program: Program, private val asmgen sta $targetName+1,y """) } - else -> TODO("assign word $word to $target") + else -> throw AssemblyError("no asm gen for assign word $word to $target") } } @@ -547,7 +546,7 @@ internal class AssignmentAsmGen(private val program: Program, private val asmgen sta $targetName,y """) } - else -> TODO("assign byte $byte to $target") + else -> throw AssemblyError("no asm gen for assign byte $byte to $target") } } @@ -600,7 +599,7 @@ internal class AssignmentAsmGen(private val program: Program, private val asmgen """) // TODO use a subroutine for this } } - else -> TODO("assign float 0.0 to $target") + else -> throw AssemblyError("no asm gen for assign float 0.0 to $target") } } else { // non-zero value @@ -660,7 +659,7 @@ internal class AssignmentAsmGen(private val program: Program, private val asmgen """) // TODO use a subroutine for this } } - else -> TODO("assign float $float to $target") + else -> throw AssemblyError("no asm gen for assign float $float to $target") } } } @@ -687,9 +686,9 @@ internal class AssignmentAsmGen(private val program: Program, private val asmgen targetArrayIdx!=null -> { val index = targetArrayIdx.arrayspec.index val targetName = asmgen.asmIdentifierName(targetArrayIdx.identifier) - TODO("assign memory byte at $address to array $targetName [ $index ]") + throw AssemblyError("no asm gen for assign memory byte at $address to array $targetName [ $index ]") } - else -> TODO("assign memory byte $target") + else -> throw AssemblyError("no asm gen for assign memory byte $target") } } else if(identifier!=null) { @@ -721,9 +720,9 @@ internal class AssignmentAsmGen(private val program: Program, private val asmgen targetArrayIdx!=null -> { val index = targetArrayIdx.arrayspec.index val targetName = asmgen.asmIdentifierName(targetArrayIdx.identifier) - TODO("assign memory byte $sourceName to array $targetName [ $index ]") + throw AssemblyError("no asm gen for assign memory byte $sourceName to array $targetName [ $index ]") } - else -> TODO("assign memory byte $target") + else -> throw AssemblyError("no asm gen for assign memory byte $target") } } } diff --git a/compiler/src/prog8/compiler/target/c64/codegen/ExpressionsAsmGen.kt b/compiler/src/prog8/compiler/target/c64/codegen/ExpressionsAsmGen.kt index 799592d63..d4a21119e 100644 --- a/compiler/src/prog8/compiler/target/c64/codegen/ExpressionsAsmGen.kt +++ b/compiler/src/prog8/compiler/target/c64/codegen/ExpressionsAsmGen.kt @@ -27,7 +27,7 @@ internal class ExpressionsAsmGen(private val program: Program, private val asmge is RegisterExpr -> translateExpression(expression) is IdentifierReference -> translateExpression(expression) is FunctionCall -> translateExpression(expression) - is ArrayLiteralValue, is StringLiteralValue -> TODO("string/array/struct assignment?") + is ArrayLiteralValue, is StringLiteralValue -> throw AssemblyError("no asm gen for string/array assignment") is StructLiteralValue -> throw AssemblyError("struct literal value assignment should have been flattened") is RangeExpr -> throw AssemblyError("range expression should have been changed into array values") }