This commit is contained in:
Irmen de Jong 2024-11-08 19:43:59 +01:00
parent 93a0a41e73
commit 3ee6058524
2 changed files with 17 additions and 2 deletions

View File

@ -1,7 +1,7 @@
TODO
====
- BUG: fix @initonce for variables that end up in zeropage.
- BUG: fix @initonce for variables that end up in zeropage. They remain uninitialized altogether now. Fix it or don't allow it?
- add unit tests for @initonce variables
- add docs about variables with @initonce initialization

View File

@ -1,6 +1,8 @@
%import textio
%option no_sysinit
%zeropage dontuse
%zeropage basicsafe
; INIT ONCE tests
main {
sub start() {
@ -26,6 +28,11 @@ main {
dump()
txt.nl()
repeat 10 {
footgun()
}
txt.nl()
sub dump() {
txt.print_uw(w0)
txt.spc()
@ -47,4 +54,12 @@ main {
txt.nl()
}
}
sub footgun() {
; TODO should just be a nonlocal variable outside of the subroutine...?
ubyte @shared @initonce @requirezp variable = 42 ; BUG: is never initialized now
txt.print_ub(variable)
txt.spc()
variable++
}
}