fixed GetDeclSymbol
This commit is contained in:
@@ -563,14 +563,36 @@ namespace Distribution
|
||||
return declSymbol;
|
||||
|
||||
auto it = declPlacesSymbol.find(position_decl);
|
||||
if (it == declPlacesSymbol.end())
|
||||
if (it != declPlacesSymbol.end())
|
||||
return it->second;
|
||||
else // find nearest
|
||||
{
|
||||
MAP<PAIR<STRING, int>, Symbol*> currFile;
|
||||
for (auto& [position, symb] : declPlacesSymbol)
|
||||
{
|
||||
if (position.first == position_decl.first)
|
||||
currFile[position] = symb;
|
||||
}
|
||||
|
||||
PAIR<int, Symbol*> nearest = { (int)0, NULL };
|
||||
const int needed_pos = position_decl.second;
|
||||
|
||||
for (auto& [position, symb] : currFile)
|
||||
{
|
||||
if (nearest.second == NULL)
|
||||
nearest = { abs(position.second - needed_pos), symb };
|
||||
|
||||
if (abs(position.second - needed_pos) < nearest.first)
|
||||
nearest = { abs(position.second - needed_pos), symb };
|
||||
}
|
||||
|
||||
if (nearest.second)
|
||||
return nearest.second;
|
||||
#if __SPF
|
||||
printInternalError(convertFileName(__FILE__).c_str(), __LINE__);
|
||||
#endif
|
||||
return NULL;
|
||||
}
|
||||
return it->second;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
Symbol* GetDeclSymbol() const { return declSymbol; }
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
#pragma once
|
||||
|
||||
#define VERSION_SPF "2455"
|
||||
#define VERSION_SPF "2456"
|
||||
|
||||
Reference in New Issue
Block a user