shithub: rgbds

Download patch

ref: 7b8d4de35c2dc284501218982fb1a05f6a1a8321
parent: c7fe281c86430cb125acbf1916b92131898eef5d
parent: b2d523acde93862fd28adcae51b9f15536d60b28
author: AntonioND <[email protected]>
date: Mon Feb 27 16:21:45 EST 2017

Merge pull request #16 from yenatch/eval-rpn-bank

rgbasm: Evaluate BANK() arguments to verify they exist.

--- a/src/asm/rpn.c
+++ b/src/asm/rpn.c
@@ -114,14 +114,11 @@
 rpn_Bank(struct Expression * expr, char *tzSym)
 {
 	if (!sym_isConstant(tzSym)) {
-		struct sSymbol *psym;
-
 		rpn_Reset(expr);
 
-		psym = sym_FindSymbol(tzSym);
-		if (nPass == 2 && psym == NULL) {
-			yyerror("'%s' not defined", tzSym);
-		}
+		/* Check that the symbol exists by evaluating and discarding the value. */
+		sym_GetValue(tzSym);
+
 		expr->isReloc = 1;
 		pushbyte(expr, RPN_BANK);
 		while (*tzSym)