data: Added intermediate fix to handle multiple definitions of main() in C/C++ (issue #233)

* record main definition as .:main:.<filename>
* restore original name in name deserialization
* don't look up id when undoing main activation
This commit is contained in:
Eberhard Graether
2019-04-30 13:04:57 +02:00
parent ee1fd9c38b
commit af70d684a5
8 changed files with 51 additions and 19 deletions
@@ -493,7 +493,13 @@ void UndoRedoController::replayCommand(std::list<Command>::iterator it)
for (SearchMatch match : matches)
{
match.tokenIds = m_storageAccess->getNodeIdsForNameHierarchies(match.tokenNames);
// TODO: replace duplicate main definition fix with better solution
if (match.nodeType.getType() != NodeType::NODE_FUNCTION || !match.tokenNames.size() ||
match.tokenNames[0].getRawName() != L"main")
{
match.tokenIds = m_storageAccess->getNodeIdsForNameHierarchies(match.tokenNames);
}
if (!match.tokenIds.size())
{
match.nodeType = NodeType::NODE_SYMBOL;