mirror of
https://github.com/cc65/cc65.git
synced 2024-09-29 02:55:20 +00:00
Second part of the experimental fix for #796.
This commit is contained in:
parent
633e0a2d64
commit
779461f407
@ -178,6 +178,9 @@ SymEntry* ParseScopedSymName (SymFindAction Action)
|
|||||||
*/
|
*/
|
||||||
if (NoScope && (Action & SYM_ALLOC_NEW) == 0) {
|
if (NoScope && (Action & SYM_ALLOC_NEW) == 0) {
|
||||||
Sym = SymFindAny (Scope, &Ident);
|
Sym = SymFindAny (Scope, &Ident);
|
||||||
|
if (!Sym) {
|
||||||
|
Sym = SymFindInChildren(Scope, &Ident);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
/* If we are processing a symbol within an expression, which the
|
/* If we are processing a symbol within an expression, which the
|
||||||
** parser expects to be constant, that symbol had to be defined
|
** parser expects to be constant, that symbol had to be defined
|
||||||
@ -193,10 +196,11 @@ SymEntry* ParseScopedSymName (SymFindAction Action)
|
|||||||
Sym = SymFindAny (Scope, &Ident);
|
Sym = SymFindAny (Scope, &Ident);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If still not found, or if in non-const expression, it will just
|
/* If still not found, or if in non-const expression, it will just
|
||||||
** get added to the current scope.
|
** get added to the current scope.
|
||||||
*/
|
*/
|
||||||
if (!Sym ) {
|
if (!Sym) {
|
||||||
Sym = SymFind (Scope, &Ident, Action);
|
Sym = SymFind (Scope, &Ident, Action);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -424,6 +424,22 @@ SymEntry* SymFind (SymTable* Scope, const StrBuf* Name, SymFindAction Action)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
SymEntry* SymFindInChildren (SymTable* Parent, const StrBuf* Name)
|
||||||
|
{
|
||||||
|
SymTable* Scope = Parent->Childs;
|
||||||
|
SymEntry* Sym = 0;
|
||||||
|
|
||||||
|
if (Scope) {
|
||||||
|
do {
|
||||||
|
Sym = SymFind(Scope, Name, SYM_CHECK_ONLY);
|
||||||
|
Scope = Scope->Next;
|
||||||
|
} while (Scope && !Sym);
|
||||||
|
}
|
||||||
|
|
||||||
|
return Sym;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
SymEntry* SymFindAny (SymTable* Scope, const StrBuf* Name)
|
SymEntry* SymFindAny (SymTable* Scope, const StrBuf* Name)
|
||||||
/* Find a symbol in the given or any of its parent scopes. The function will
|
/* Find a symbol in the given or any of its parent scopes. The function will
|
||||||
|
@ -122,6 +122,12 @@ SymEntry* SymFindLocal (SymEntry* Parent, const StrBuf* Name, SymFindAction Acti
|
|||||||
** created, or - in case Action is SYM_FIND_EXISTING - return 0.
|
** created, or - in case Action is SYM_FIND_EXISTING - return 0.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
SymEntry* SymFindInChildren (SymTable* Scope, const StrBuf* Name);
|
||||||
|
/* Find a symbol in children scopes of given scope (if they exist). The
|
||||||
|
** function will never create a new symbol, since this can only be done in one
|
||||||
|
** specific scope.
|
||||||
|
*/
|
||||||
|
|
||||||
SymEntry* SymFind (SymTable* Scope, const StrBuf* Name, SymFindAction Action);
|
SymEntry* SymFind (SymTable* Scope, const StrBuf* Name, SymFindAction Action);
|
||||||
/* Find a new symbol table entry in the given table. If Action contains
|
/* Find a new symbol table entry in the given table. If Action contains
|
||||||
** SYM_ALLOC_NEW and the entry is not found, create a new one. Return the
|
** SYM_ALLOC_NEW and the entry is not found, create a new one. Return the
|
||||||
|
Loading…
Reference in New Issue
Block a user