Allow shifting macro arguments by a negative amount

Fixes #733
This commit is contained in:
Rangi
2021-02-12 23:09:06 -05:00
committed by Eldred Habert
parent 96bce05be2
commit 8f20620c16
5 changed files with 18 additions and 5 deletions

View File

@@ -1,4 +1,16 @@
reverse: MACRO
for i, _NARG
i = _NARG - i - 1
shift i
println \1
shift -i
endr
ENDM
reverse $1, $2, $3
m: MACRO
shift 2
shift -3
ENDM
m

View File

@@ -1,3 +0,0 @@
ERROR: shift-negative.asm(4) -> shift-negative.asm::m(2):
Cannot shift arguments by negative amount -3
error: Assembly aborted (1 errors)!

View File

@@ -0,0 +1,3 @@
$3
$2
$1