data: Removed separate comment_location table

* added LocationType LOCATION_COMMENT
* store comment locations within source_locations
This commit is contained in:
Eberhard Graether
2018-10-04 21:21:31 +02:00
parent f060b6042d
commit 9edfdacd72
24 changed files with 80 additions and 408 deletions
@@ -138,11 +138,6 @@ void PersistentStorage::addComponentAccesses(const std::vector<StorageComponentA
m_sqliteIndexStorage.addComponentAccesses(componentAccesses);
}
void PersistentStorage::addCommentLocation(const StorageCommentLocationData& data)
{
m_sqliteIndexStorage.addCommentLocation(data);
}
void PersistentStorage::addError(const StorageErrorData& data)
{
m_sqliteIndexStorage.addError(data);
@@ -188,16 +183,6 @@ const std::set<StorageComponentAccess>& PersistentStorage::getComponentAccesses(
return m_storageData.accesses = utility::toSet(m_sqliteIndexStorage.getAll<StorageComponentAccess>());
}
const std::set<StorageCommentLocationData>& PersistentStorage::getCommentLocations() const
{
std::set<StorageCommentLocationData> comments;
for (const StorageCommentLocation& comment : m_sqliteIndexStorage.getAll<StorageCommentLocation>())
{
comments.emplace(comment);
}
return m_storageData.comments = comments;
}
const std::vector<StorageErrorData>& PersistentStorage::getErrors() const
{
std::vector<StorageErrorData> errors;
@@ -1449,29 +1434,6 @@ std::shared_ptr<SourceLocationFile> PersistentStorage::getSourceLocationsOfTypeI
return m_sqliteIndexStorage.getSourceLocationsOfTypeInFile(filePath, type);
}
std::shared_ptr<SourceLocationFile> PersistentStorage::getCommentLocationsInFile(const FilePath& filePath) const
{
TRACE();
const std::shared_ptr<SourceLocationFile> file = std::make_shared<SourceLocationFile>(filePath, false, false, false);
const std::vector<StorageCommentLocation> storageLocations = m_sqliteIndexStorage.getCommentLocationsInFile(filePath);
for (size_t i = 0; i < storageLocations.size(); i++)
{
file->addSourceLocation(
LOCATION_TOKEN,
storageLocations[i].id,
std::vector<Id>(), // comment token location has no element.
storageLocations[i].startLine,
storageLocations[i].startCol,
storageLocations[i].endLine,
storageLocations[i].endCol
);
}
return file;
}
std::shared_ptr<TextAccess> PersistentStorage::getFileContent(const FilePath& filePath) const
{
TRACE();