ca65 improve error for unclosed scopes

See: #1779
This commit is contained in:
bbbradsmith 2023-02-20 20:42:09 -05:00
parent d0f17ba602
commit f1134cc5f1
1 changed files with 12 additions and 1 deletions

View File

@ -570,7 +570,18 @@ void SymCheck (void)
/* Check for open scopes */
if (CurrentScope->Parent != 0) {
Error ("Local scope was not closed");
if (CurrentScope->Label) {
/* proc has a label indicating the line it was opened. */
LIError (&CurrentScope->Label->DefLines,
"Local proc '%s' was not closed",
GetString (CurrentScope->Name));
} else {
/* scope has no label to track a line number, uses end-of-document line instead.
** Anonymous scopes will reveal their internal automatic name.
*/
Error ("Local scope '%s' was not closed",
GetString (CurrentScope->Name));
}
}
/* First pass: Walk through all symbols, checking for undefined's and