data: Saving TokenLocations of scopes separately

This change parses the TokenLocations of scopes of classes, structs, functions, methods, namespaces and enums and
saves them in Storage with type LOCATION_SCOPE. The TokenLocations of these nodes are just their name declarations now.
Scope locations are displayed in blue color in the code view.
This commit is contained in:
Eberhard Graether
2014-07-28 17:54:36 +02:00
parent 182e18840e
commit 96df63055a
18 changed files with 261 additions and 114 deletions
+27 -9
View File
@@ -5,6 +5,7 @@
TokenLocation::TokenLocation(Id tokenId, TokenLocationLine* line, unsigned int columnNumber, bool isStart)
: m_id(s_locationId++)
, m_tokenId(tokenId)
, m_type(LOCATION_TOKEN)
, m_line(line)
, m_columnNumber(columnNumber)
, m_other(nullptr)
@@ -12,16 +13,28 @@ TokenLocation::TokenLocation(Id tokenId, TokenLocationLine* line, unsigned int c
{
}
TokenLocation::TokenLocation(Id id, Id tokenId, TokenLocationLine* line, unsigned int columnNumber, bool isStart)
: m_id(id)
, m_tokenId(tokenId)
TokenLocation::TokenLocation(TokenLocation *other, TokenLocationLine* line, unsigned int columnNumber, bool isStart)
: m_id(other->m_id)
, m_tokenId(other->m_tokenId)
, m_type(other->m_type)
, m_line(line)
, m_columnNumber(columnNumber)
, m_other(nullptr)
, m_other(other)
, m_isStart(isStart)
{
}
TokenLocation::TokenLocation(const TokenLocation& other, TokenLocationLine* line)
: m_id(other.m_id)
, m_tokenId(other.m_tokenId)
, m_type(other.m_type)
, m_line(line)
, m_columnNumber(other.m_columnNumber)
, m_other(nullptr)
, m_isStart(other.m_isStart)
{
}
TokenLocation::~TokenLocation()
{
}
@@ -36,6 +49,16 @@ Id TokenLocation::getTokenId() const
return m_tokenId;
}
TokenLocation::LocationType TokenLocation::getType() const
{
return m_type;
}
void TokenLocation::setType(LocationType type)
{
m_type = type;
}
TokenLocationLine* TokenLocation::getTokenLocationLine() const
{
return m_line;
@@ -105,11 +128,6 @@ bool TokenLocation::isEndTokenLocation() const
return !m_isStart;
}
std::shared_ptr<TokenLocation> TokenLocation::createPlainCopy(TokenLocationLine* line) const
{
return std::shared_ptr<TokenLocation>(new TokenLocation(m_id, m_tokenId, line, m_columnNumber, m_isStart));
}
Id TokenLocation::s_locationId = 1;
std::ostream& operator<<(std::ostream& ostream, const TokenLocation& location)