+static SymEntry* SymRefInternal (SymTable* Table, const char* Name)
+/* Search for the symbol in the given table and return it */
+{
+ /* Try to find the symbol, create a new one if the symbol does not exist */
+ SymEntry* S = SymFind (Table, Name, SF_ALLOC_NEW);
+
+ /* Mark the symbol as referenced */
+ S->Flags |= SF_REFERENCED;
+
+ /* Return it */
+ return S;
+}
+
+
+
void SymEnterLevel (void)
/* Enter a new lexical level */
{
SymEntry* SymRef (const char* Name)
/* Search for the symbol and return it */
{
- /* Try to find the symbol in any visible table */
- SymEntry* S = SymFindAny (SymTab, Name);
-
- /* If we could not find the symbol, create it in the local symtab */
- if (S == 0) {
- S = SymFind (SymTab, Name, SF_ALLOC_NEW);
- }
-
- /* Mark the symbol as referenced */
- S->Flags |= SF_REFERENCED;
-
- /* Return it */
- return S;
+ /* Reference the symbol in the current table */
+ return SymRefInternal (SymTab, Name);
}
SymEntry* SymRefGlobal (const char* Name)
/* Search for the symbol in the global namespace and return it */
{
- /* Try to find the symbol, create a new one if the symbol does not exist */
- SymEntry* S = SymFind (RootTab, Name, SF_ALLOC_NEW);
-
- /* Mark the symbol as referenced */
- S->Flags |= SF_REFERENCED;
-
- /* Return it */
- return S;
+ /* Reference the symbol in the current table */
+ return SymRefInternal (RootTab, Name);
}