pawn-lang / compiler

Pawn compiler for SA-MP with bug fixes and new features - runs on Windows, Linux, macOS
Other
306 stars 72 forks source link

Fix redefinition of enum elements #598

Closed Daniel-Cortez closed 3 years ago

Daniel-Cortez commented 4 years ago

What this PR does / why we need it:

Makes function symbol_cache_add() add symbols with the same name into the head of the entry list. This allows find_symbol() to pick the last defined symbol when there are multiple symbols with the same name, thus returning it the old behavior it had before the adoption of the hashtable-based symbol search algorithm, and fixing a problem with findglb() returning wrong symbols when being called from add_constant() (see #597).

Which issue(s) this PR fixes:

Fixes #597

What kind of pull this is:

Additional Documentation:

Daniel-Cortez commented 4 years ago

Updated with a much more simple fix that doesn't introduce any extra parameters for function findglb() and just returns the old behavior for function find_symbol() (see the 1'st post for details).