1
0
mirror of https://github.com/catseye/SixtyPical.git synced 2025-02-09 01:30:50 +00:00

Apparently this hack was only needed previously due to a bug?

This commit is contained in:
Chris Pressey 2017-12-12 14:55:57 +00:00
parent 7d11273c6c
commit 3417fd96c7
2 changed files with 20 additions and 3 deletions

View File

@ -202,9 +202,6 @@ routine game_state_title_screen
// call clear_screen
// call init_game
copy game_state_play, dispatch_game_state
} else {
// This is sort of a hack. FIXME: let `if` branches diverge this much.
copy forward game_state_title_screen, dispatch_game_state
}
goto save_cinv

View File

@ -1065,6 +1065,26 @@ If a location is initialized in one block, is must be initialized in the other a
| }
? InconsistentInitializationError: x
However, this only pertains to initialization. If a value is already
initialized, either because it was set previous to the `if`, or is an
input to the routine, and it is initialized in one branch, it need not
be initialized in the other.
| routine foo
| inputs x
| outputs x
| trashes a, z, n, c
| {
| ld a, 0
| cmp a, 42
| if z {
| ld x, 7
| } else {
| ld a, 23
| }
| }
= ok
An `if` with a single block is analyzed as if it had an empty `else` block.
| routine foo