Files
rgbds/test/asm/sym-scope.asm
Damian Yerrick e1f0a13e5a Allow defining local labels for another scope (#1159)
fix #1157 for the following source code

```
section "hSAVE_locals",HRAM
func3.hSpam: ds 1  ; no longer produces an error
;.hEggs: ds 1      ; uncomment this to see the new error

section "demo",ROM0
func3:
  ldh a, [.hSpam]
  ret
```

Remove two errors:
- `Not currently in the scope of 'func3'`
- `Local label 'func3.hSpam' in main scope`

Add one error:
- `Relative local label '.hSpam' in main scope`

Co-authored-by: Rangi <35663410+Rangi42@users.noreply.github.com>
2023-08-20 02:29:53 +02:00

23 lines
455 B
NASM

SECTION "Scopes", ROM0
; Tests of injecting local labels into another label's scope.
; This construction is useful to define a subroutine's local variables
; in WRAM or HRAM.
Valid.syntax
Parent:
.loc
dw Parent.loc ; This is what it should expand to
Parent.explicit
dw .explicit ; This should expand to the above
; Note that `Parentheses` begins with `Parent`,
; which string checks may fail to handle
Parentheses.check
Parentheses:
Parent.check