mirror of
https://github.com/irmen/prog8.git
synced 2024-10-25 00:24:16 +00:00
ir: ignore empty chunks instead of crashing
This commit is contained in:
parent
36bfef567d
commit
172e78e8f2
@ -283,15 +283,10 @@ class IRCodeGen(
|
|||||||
else -> TODO("missing codegen for $node")
|
else -> TODO("missing codegen for $node")
|
||||||
}
|
}
|
||||||
|
|
||||||
chunks.forEach { chunk ->
|
val nonEmptyChunks = chunks.filter { it.isNotEmpty() || it.label != null }
|
||||||
require(chunk.isNotEmpty() || chunk.label != null) {
|
nonEmptyChunks.filterIsInstance<IRCodeChunk>().firstOrNull()?.appendSrcPosition(node.position)
|
||||||
"chunk should have instructions and/or a label"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
chunks.filterIsInstance<IRCodeChunk>().firstOrNull()?.appendSrcPosition(node.position)
|
return nonEmptyChunks
|
||||||
|
|
||||||
return chunks
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun readBinaryData(node: PtIncludeBinary): Collection<UByte> {
|
private fun readBinaryData(node: PtIncludeBinary): Collection<UByte> {
|
||||||
|
@ -2,6 +2,9 @@
|
|||||||
TODO
|
TODO
|
||||||
====
|
====
|
||||||
|
|
||||||
|
- 10 * (uw/10) is correct, (uw/10) * 10 fails with -noopt 10 * (uw/10) needs -noopt to work correctly
|
||||||
|
- don't print the leading space in print_f()
|
||||||
|
- uword scanline_buf = memory("scanline", 320, 0) different result when inside a sub or outside a sub??! (imageviewer iff module)
|
||||||
- [on branch: shortcircuit] investigate McCarthy evaluation again? this may also reduce code size perhaps for things like if a>4 or a<2 ....
|
- [on branch: shortcircuit] investigate McCarthy evaluation again? this may also reduce code size perhaps for things like if a>4 or a<2 ....
|
||||||
- once VAL_1 is merged into the kernal properly, remove all the workarounds in cx16 floats.parse_f()
|
- once VAL_1 is merged into the kernal properly, remove all the workarounds in cx16 floats.parse_f()
|
||||||
|
|
||||||
|
@ -1,25 +1,13 @@
|
|||||||
%import textio
|
%import textio
|
||||||
%import floats
|
|
||||||
%import string
|
|
||||||
%zeropage basicsafe
|
%zeropage basicsafe
|
||||||
%option no_sysinit
|
%option no_sysinit
|
||||||
|
|
||||||
main {
|
main {
|
||||||
sub start() {
|
sub start() {
|
||||||
str buffer = "???????????????????????????"
|
ubyte uw = 97
|
||||||
repeat {
|
txt.print_ub( 10 * (uw/10) ) ; 90
|
||||||
txt.print("enter number: ")
|
txt.nl()
|
||||||
void txt.input_chars(buffer)
|
txt.print_ub( (uw/10) * 10 ) ; 90
|
||||||
txt.print("\nprog8's parse_f: ")
|
|
||||||
float value = floats.parse_f(buffer)
|
|
||||||
floats.print_f(value)
|
|
||||||
|
|
||||||
; floats.VAL_1 is defined as:
|
|
||||||
; romsub $fe09 = VAL_1(uword string @XY, ubyte length @A) clobbers(A,X,Y) -> float @FAC1
|
|
||||||
; txt.print("\nrom val_1: ")
|
|
||||||
; value = floats.VAL_1(buffer, string.length(buffer))
|
|
||||||
; floats.print_f(value)
|
|
||||||
txt.nl()
|
txt.nl()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
Loading…
Reference in New Issue
Block a user