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

Symbols are created when using a label in the wild, even if they aren't defined. Solely using a symbol as an argument to BANK() skips this, so the symbol is never created.

This evaluates the argument instead of trying to find a symbol. This way, symbols that don't exist are created when passed into BANK().
This commit is contained in:
yenatch
2014-02-01 20:50:39 -05:00
parent 0f488b6759
commit b2d523acde

View File

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