Only define @ and _NARG when they have values (#1073)

Fixes #1069

Co-authored-by: Eldred Habert <eldredhabert0@gmail.com>
This commit is contained in:
Rangi
2022-09-30 19:04:03 -04:00
committed by GitHub
parent 140c6b169e
commit 08545643cf
16 changed files with 62 additions and 26 deletions

View File

@@ -1,2 +0,0 @@
if "{@}"
endc

View File

@@ -1,5 +0,0 @@
error: if@-no-sect.asm(1):
PC has no value outside a section
warning: if@-no-sect.asm(1): [-Wnumeric-string]
Treating 2-character string as a number
error: Assembly aborted (1 error)!

View File

@@ -1 +0,0 @@
PRINTLN "{_NARG}"

View File

@@ -1,3 +0,0 @@
error: narg-nosect.asm(1):
_NARG does not make sense outside of a macro
error: Assembly aborted (1 error)!

View File

@@ -1 +0,0 @@
$0

View File

@@ -1,5 +0,0 @@
IF DEF(@)
PRINTLN "defined"
ELSE
PRINTLN "not defined"
ENDC

View File

View File

@@ -1 +0,0 @@
defined

View File

@@ -0,0 +1,21 @@
; not inside a section
assert !DEF(@)
println @
println "{@}?"
; not inside a macro
assert !DEF(_NARG)
println _NARG
println "{_NARG}?"
SECTION "s", ROM0[$42]
assert DEF(@)
println @
println "{@}!"
MACRO m
assert DEF(_NARG)
println _NARG
println "{_NARG}!"
ENDM
m 1, 2, 3

View File

@@ -0,0 +1,9 @@
error: undefined-builtins.asm(3):
PC has no value outside a section
error: undefined-builtins.asm(4):
Interpolated symbol "@" does not exist
error: undefined-builtins.asm(8):
_NARG does not make sense outside of a macro
error: undefined-builtins.asm(9):
Interpolated symbol "_NARG" does not exist
error: Assembly aborted (4 errors)!

View File

@@ -0,0 +1,8 @@
$0
?
$0
?
$42
$42!
$3
$3!