When the scope is not found on ancestors, create on current scope.
This solves comment https://github.com/cc65/cc65/pull/1358#issuecomment-3193961949
This commit is contained in:
@@ -1320,7 +1320,7 @@ if you want to access the "other" symbol <tt/bar/, you would have to write:
|
|||||||
</verb></tscreen>
|
</verb></tscreen>
|
||||||
|
|
||||||
The above example also shows that to search a scope that is not yet defined in
|
The above example also shows that to search a scope that is not yet defined in
|
||||||
the code above the usage, you must use the namespace token (<tt/::/) and
|
the code above the usage, you should use the namespace token (<tt/::/) and
|
||||||
specify the full scope name, to allow the assembler to create the scope at the
|
specify the full scope name, to allow the assembler to create the scope at the
|
||||||
correct place.
|
correct place.
|
||||||
|
|
||||||
|
|||||||
@@ -94,11 +94,15 @@ SymTable* ParseScopedIdent (StrBuf* Name, StrBuf* FullName)
|
|||||||
*/
|
*/
|
||||||
Scope = SymFindAnyScope (CurrentScope, Name);
|
Scope = SymFindAnyScope (CurrentScope, Name);
|
||||||
if (Scope == 0) {
|
if (Scope == 0) {
|
||||||
/* Scope not found */
|
/* Scope not found, create a new scope here */
|
||||||
|
Scope = SymFindScope (CurrentScope, Name, SYM_ALLOC_NEW);
|
||||||
|
if (Scope == 0) {
|
||||||
SB_Terminate (FullName);
|
SB_Terminate (FullName);
|
||||||
Error ("No such scope: `%m%p'", FullName);
|
/* Scope not found */
|
||||||
|
Error ("Can't create scope: `%m%p'", FullName);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user