From 2454ab831c62bb2f6a443f0f28e9d31a3d28a6e1 Mon Sep 17 00:00:00 2001 From: Daniel Serpell Date: Sun, 17 Aug 2025 20:24:08 -0400 Subject: [PATCH] When creating a new scope for a forwarded symbol, do not open it. This fixes las example in the PR. --- src/ca65/symtab.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/ca65/symtab.c b/src/ca65/symtab.c index 977943179..ecd746d8b 100644 --- a/src/ca65/symtab.c +++ b/src/ca65/symtab.c @@ -218,6 +218,8 @@ void SymEnterLevel (const StrBuf* ScopeName, unsigned char Type, if (CurrentScope->Flags & ST_DEFINED) { Error ("Duplicate scope `%m%p'", ScopeName); } + /* Open the scope as we are entering it */ + CurrentScope->Flags &= ~ST_CLOSED; } else { CurrentScope = RootScope = NewSymTable (0, ScopeName); @@ -294,6 +296,8 @@ SymTable* SymFindScope (SymTable* Parent, const StrBuf* Name, SymFindAction Acti /* Create a new scope if requested and we didn't find one */ if (*T == 0 && (Action & SYM_ALLOC_NEW) != 0) { *T = NewSymTable (Parent, Name); + /* Close the created scope, will be reopened if needed */ + (*T)->Flags |= ST_CLOSED; } /* Return the scope */