Return a consistent number for const BANK() when erroring out

This commit is contained in:
ISSOtm
2020-01-12 13:01:46 +01:00
parent eb82476591
commit 23ab245cec
2 changed files with 5 additions and 6 deletions

View File

@@ -40,15 +40,14 @@ void constexpr_Symbol(struct ConstExpression *expr, char *tzSym)
void constexpr_BankSymbol(struct ConstExpression *expr, char *tzSym)
{
constexpr_Number(expr, 0);
if (sym_FindSymbol(tzSym) == pPCSymbol) {
if (pCurrentSection->nBank == -1)
yyerror("%s's bank is not known yet", tzSym);
else
constexpr_Number(expr, pCurrentSection->nBank);
return;
}
if (sym_isConstant(tzSym)) {
} else if (sym_isConstant(tzSym)) {
yyerror("BANK argument must be a relocatable identifier");
} else {
struct sSymbol *pSymbol = sym_FindSymbol(tzSym);
@@ -64,6 +63,7 @@ void constexpr_BankSymbol(struct ConstExpression *expr, char *tzSym)
void constexpr_BankSection(struct ConstExpression *expr, char *tzSectionName)
{
constexpr_Number(expr, 0);
struct Section *pSection = out_FindSectionByName(tzSectionName);
if (!pSection)

View File

@@ -2,5 +2,4 @@ ERROR: pc-bank.asm(2):
Source address $2a00 not in $FF00 to $FFFF
ERROR: pc-bank.asm(11):
@'s bank is not known yet
ERROR: pc-bank.asm(11):
Non-constant expression
error: Assembly aborted (2 errors)!