mirror of
https://github.com/gbdev/rgbds.git
synced 2025-11-28 22:07:49 +00:00
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>
This commit is contained in:
@@ -1,3 +1,3 @@
|
||||
error: local-without-parent.asm(2):
|
||||
Local label '.test' in main scope
|
||||
Unqualified local label '.test' in main scope
|
||||
error: Assembly aborted (1 error)!
|
||||
|
||||
@@ -1,6 +0,0 @@
|
||||
SECTION "sec", ROM0
|
||||
|
||||
Parent:
|
||||
db 0
|
||||
WrongParent.child
|
||||
db 0
|
||||
@@ -1,3 +0,0 @@
|
||||
error: local-wrong-parent.asm(5):
|
||||
Not currently in the scope of 'WrongParent'
|
||||
error: Assembly aborted (1 error)!
|
||||
@@ -1,8 +1,9 @@
|
||||
SECTION "Scopes", ROM0
|
||||
|
||||
; Neither of these should be created
|
||||
.tooSoon
|
||||
Nice.try
|
||||
; 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
|
||||
@@ -11,8 +12,8 @@ Parent.explicit
|
||||
dw .explicit ; This should expand to the above
|
||||
|
||||
|
||||
; None of the two locals below should manage to be created, being in the wrong scopes
|
||||
; Note however that `Parentheses` begins with `Parent`, which string checks may fail to handle
|
||||
; Note that `Parentheses` begins with `Parent`,
|
||||
; which string checks may fail to handle
|
||||
|
||||
Parentheses.check
|
||||
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
error: sym-scope.asm(4):
|
||||
Local label '.tooSoon' in main scope
|
||||
error: sym-scope.asm(5):
|
||||
Local label 'Nice.try' in main scope
|
||||
error: sym-scope.asm(17):
|
||||
Not currently in the scope of 'Parentheses'
|
||||
error: sym-scope.asm(21):
|
||||
Not currently in the scope of 'Parent'
|
||||
error: Assembly aborted (4 errors)!
|
||||
|
||||
Reference in New Issue
Block a user