asmgen: string values cannot be typecasted

This commit is contained in:
Irmen de Jong 2021-03-24 21:49:33 +01:00
parent 112a7b09f2
commit 292640b17a
2 changed files with 8 additions and 15 deletions

View File

@ -571,11 +571,7 @@ internal class AssignmentAsmGen(private val program: Program, private val asmgen
else -> throw AssemblyError("weird type")
}
}
DataType.STR -> {
if (targetDt != DataType.UWORD && targetDt == DataType.STR)
throw AssemblyError("cannot typecast a string into another incompatitble type")
TODO("assign typecasted string into target var")
}
DataType.STR -> throw AssemblyError("cannot typecast a string value")
else -> throw AssemblyError("weird type")
}
}
@ -710,11 +706,7 @@ internal class AssignmentAsmGen(private val program: Program, private val asmgen
else -> throw AssemblyError("weird type")
}
}
DataType.STR -> {
if (targetDt != DataType.UWORD && targetDt == DataType.STR)
throw AssemblyError("cannot typecast a string into another incompatitble type")
TODO("assign typecasted string into target var")
}
DataType.STR -> throw AssemblyError("cannot typecast a string value")
else -> throw AssemblyError("weird type")
}
}

View File

@ -5,13 +5,14 @@ main {
sub start() {
ubyte zero
ubyte one=1
str string1 = "irmen"
str string2 = "hello"
ubyte qq=1
qq = qq + c64.CHKIN(1) * qq
uword xx = $f000
txt.print_ub(qq)
; string1 = xx
; string1 = string2
string1 = string2 as uword
; ubyte[] array = [1,2,3,4]
; ubyte ix