Fix the behavior of variable symbols in regard to cheap locals. Previously

every assignment to a variable symbol opened the same scope for cheap locals.
So when redefining a variable symbol, an old cheap local scope was reopened
which was unexpected and confusing. The change fixes this so that only the
first definition of a variable symbol opens a new scope for cheap locals, but
redefinitions of the same symbol do not.
This commit is contained in:
Kugel Fuhr
2025-06-19 09:11:30 +02:00
parent 24b7d1fec7
commit 54f63a0cdc
2 changed files with 35 additions and 2 deletions

28
test/asm/err/bug505.s Normal file
View File

@@ -0,0 +1,28 @@
; Test for #525 taken from the issue
; Redefining a variable symbol "reopens" the old name space for cheap locals
; Behavior should be: First definition of a variable symbol opens a new
; scope for cheap locals, redefinitions of the same symbols do not.
;this starts a new scope for cheap local lables
SomeSymbol .set 4
jmp @CheapLocal1
@CheapLocal0:
.byte $8b
CheapLocalScopeBreaker0:
CheapLocalScopeBreaker1:
CheapLocalScopeBreaker2:
CheapLocalScopeBreaker3:
;this continues the same cheap scope as before, regardless of the many global labels in between
SomeSymbol .set 5
@CheapLocal1:
lda @CheapLocal0