mirror of
https://github.com/gbdev/rgbds.git
synced 2025-11-24 12:02:08 +00:00
Track local label scope, string equated as .. (#1504)
This commit is contained in:
@@ -1,12 +1,18 @@
|
||||
ASSERT !DEF(@) && !DEF(.)
|
||||
ASSERT !DEF(@) && !DEF(.) && !DEF(..)
|
||||
|
||||
PURGE @, .
|
||||
PURGE @, ., ..
|
||||
|
||||
SECTION "test", ROM0[42]
|
||||
Foobar:
|
||||
db 1
|
||||
Foo:
|
||||
db 2
|
||||
.bar
|
||||
db 3
|
||||
|
||||
PURGE @, .
|
||||
PURGE @, ., ..
|
||||
|
||||
ASSERT DEF(@) && DEF(.) && DEF(Foobar)
|
||||
ASSERT DEF(@) && DEF(.) && DEF(..) && DEF(Foo) && DEF(.bar)
|
||||
|
||||
PRINTLN "PC: {#05X:@}; label scope: \"{.}\"; {.}: {#05X:{.}}"
|
||||
PRINTLN "PC: {#05X:@}"
|
||||
PRINTLN "global scope: \"{.}\" ({#05X:{.}})"
|
||||
PRINTLN "local scope: \"{..}\" ({#05X:{..}})"
|
||||
|
||||
@@ -2,8 +2,12 @@ error: label-scope.asm(3):
|
||||
'@' not defined
|
||||
error: label-scope.asm(3):
|
||||
'.' not defined
|
||||
error: label-scope.asm(8):
|
||||
error: label-scope.asm(3):
|
||||
'..' not defined
|
||||
error: label-scope.asm(12):
|
||||
Built-in symbol '@' cannot be purged
|
||||
error: label-scope.asm(8):
|
||||
error: label-scope.asm(12):
|
||||
Built-in symbol '.' cannot be purged
|
||||
error: Assembly aborted (4 errors)!
|
||||
error: label-scope.asm(12):
|
||||
Built-in symbol '..' cannot be purged
|
||||
error: Assembly aborted (6 errors)!
|
||||
|
||||
@@ -1 +1,3 @@
|
||||
PC: $002A; label scope: "Foobar"; Foobar: $002A
|
||||
PC: $002D
|
||||
global scope: "Foo" ($002B)
|
||||
local scope: "Foo.bar" ($002C)
|
||||
|
||||
@@ -1,6 +1,33 @@
|
||||
section "period", rom0
|
||||
SECTION "period", ROM0
|
||||
|
||||
global1: db 1
|
||||
.local db 2
|
||||
. db 3 ; this...
|
||||
global1 db 4 ; ...expands to this
|
||||
assert !def(.) && !def(..)
|
||||
|
||||
global1:
|
||||
assert !strcmp("{.}", "global1") && !def(..)
|
||||
|
||||
.local1:
|
||||
assert !strcmp("{.}", "global1") && !strcmp("{..}", "global1.local1")
|
||||
|
||||
global1.local2:
|
||||
assert !strcmp("{.}", "global1") && !strcmp("{..}", "global1.local2")
|
||||
|
||||
global2:
|
||||
assert !strcmp("{.}", "global2") && !def(..)
|
||||
|
||||
.local1:
|
||||
assert !strcmp("{.}", "global2") && !strcmp("{..}", "global2.local1")
|
||||
|
||||
LOAD "load", WRAM0
|
||||
assert !def(.) && !def(..)
|
||||
|
||||
wGlobal1:
|
||||
assert !strcmp("{.}", "wGlobal1") && !def(..)
|
||||
|
||||
.wLocal1:
|
||||
assert !strcmp("{.}", "wGlobal1") && !strcmp("{..}", "wGlobal1.wLocal1")
|
||||
|
||||
wGlobal2:
|
||||
assert !strcmp("{.}", "wGlobal2") && !def(..)
|
||||
|
||||
ENDL
|
||||
assert !strcmp("{.}", "global2") && !strcmp("{..}", "global2.local1")
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
error: period.asm(5):
|
||||
syntax error, unexpected DB, expecting : or ::
|
||||
error: period.asm(6):
|
||||
syntax error, unexpected DB, expecting : or ::
|
||||
error: Assembly aborted (2 errors)!
|
||||
@@ -3,11 +3,16 @@ assert !DEF(@)
|
||||
println @
|
||||
println "{@}?"
|
||||
|
||||
; not inside a label scope
|
||||
; not inside a global scope
|
||||
assert !DEF(.)
|
||||
println .
|
||||
println "{.}?"
|
||||
|
||||
; not inside a local scope
|
||||
assert !DEF(..)
|
||||
println ..
|
||||
println "{..}?"
|
||||
|
||||
; not inside a macro
|
||||
assert !DEF(_NARG)
|
||||
println _NARG
|
||||
@@ -18,11 +23,16 @@ assert DEF(@)
|
||||
println @
|
||||
println "{@}!"
|
||||
|
||||
LabelScope:
|
||||
GlobalScope:
|
||||
assert DEF(.)
|
||||
println .
|
||||
println "{.}!"
|
||||
|
||||
.localScope:
|
||||
assert DEF(..)
|
||||
println ..
|
||||
println "{..}!"
|
||||
|
||||
MACRO m
|
||||
assert DEF(_NARG)
|
||||
println _NARG
|
||||
|
||||
@@ -7,7 +7,11 @@ error: undefined-builtins.asm(8):
|
||||
error: undefined-builtins.asm(9):
|
||||
Interpolated symbol "." does not exist
|
||||
error: undefined-builtins.asm(13):
|
||||
_NARG has no value outside of a macro
|
||||
".." has no value outside of a local label scope
|
||||
error: undefined-builtins.asm(14):
|
||||
Interpolated symbol ".." does not exist
|
||||
error: undefined-builtins.asm(18):
|
||||
_NARG has no value outside of a macro
|
||||
error: undefined-builtins.asm(19):
|
||||
Interpolated symbol "_NARG" does not exist
|
||||
error: Assembly aborted (6 errors)!
|
||||
error: Assembly aborted (8 errors)!
|
||||
|
||||
@@ -1,12 +1,16 @@
|
||||
$0
|
||||
?
|
||||
|
||||
?
|
||||
|
||||
?
|
||||
$0
|
||||
?
|
||||
$42
|
||||
$42!
|
||||
$42
|
||||
LabelScope!
|
||||
GlobalScope!
|
||||
$42
|
||||
GlobalScope.localScope!
|
||||
$3
|
||||
$3!
|
||||
|
||||
Reference in New Issue
Block a user