gosub only uses an identifier

This commit is contained in:
Irmen de Jong
2022-03-22 20:53:06 +01:00
parent 97b3a0b093
commit 7b27d270a2
15 changed files with 47 additions and 89 deletions
@@ -135,13 +135,7 @@ class CodeGen(internal val program: PtProgram,
private fun translate(gosub: PtGosub): VmCodeChunk {
val chunk = VmCodeChunk()
if(gosub.address!=null)
throw AssemblyError("cannot gosub to a memory address in the vm target")
else if(gosub.identifier!=null) {
chunk += VmCodeOpcodeWithStringArg(Opcode.GOSUB, gosubArg(gosub.identifier!!.targetName))
} else if(gosub.generatedLabel!=null) {
chunk += VmCodeOpcodeWithStringArg(Opcode.GOSUB, gosubArg(listOf(gosub.generatedLabel!!)))
}
chunk += VmCodeOpcodeWithStringArg(Opcode.GOSUB, gosubArg(gosub.identifier.targetName))
return chunk
}