Clean up label generation

Only check for localness when we already know we have a local
This commit is contained in:
ISSOtm
2020-10-03 21:33:30 +02:00
parent f53ad359a6
commit 2e3db9d56a
8 changed files with 161 additions and 129 deletions

View File

@@ -1,5 +1,5 @@
ERROR: label-macro-arg.asm(44) -> label-macro-arg.asm::test_char(31):
Local label in main scope
Local label 'sizeof_.something' in main scope
while expanding symbol "VAR_DEF"
ERROR: label-macro-arg.asm(44) -> label-macro-arg.asm::test_char(31):
syntax error

21
test/asm/sym-scope.asm Normal file
View File

@@ -0,0 +1,21 @@
SECTION "Scopes", ROM0
; Neither of these should be created
.tooSoon
Nice.try
Parent:
.loc
dw Parent.loc ; This is what it should expand to
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
Parentheses.check
Parentheses:
Parent.check

9
test/asm/sym-scope.err Normal file
View File

@@ -0,0 +1,9 @@
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.check'
ERROR: sym-scope.asm(21):
Not currently in the scope of 'Parent.check'
error: Assembly aborted (4 errors)!

0
test/asm/sym-scope.out Normal file
View File