data: cleaned up TokenLocation classes
* removed self assiged locationId * show errors after parse again
This commit is contained in:
@@ -261,6 +261,8 @@ void QtCodeArea::mouseMoveEvent(QMouseEvent* event)
|
||||
annotation = nullptr;
|
||||
}
|
||||
|
||||
QToolTip::hideText();
|
||||
|
||||
if (annotation != m_hoveredAnnotation)
|
||||
{
|
||||
setHoveredAnnotation(annotation);
|
||||
@@ -269,11 +271,7 @@ void QtCodeArea::mouseMoveEvent(QMouseEvent* event)
|
||||
|
||||
if (annotation && errorMessages.size() > annotation->tokenId)
|
||||
{
|
||||
QToolTip::showText(event->globalPos(), QString::fromStdString(m_fileWidget->getErrorMessages()[annotation->tokenId]));
|
||||
}
|
||||
else
|
||||
{
|
||||
QToolTip::hideText();
|
||||
QToolTip::showText(event->globalPos(), QString::fromStdString(errorMessages[annotation->tokenId]));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+11
-10
@@ -5,10 +5,10 @@
|
||||
|
||||
#include "utility/logging/logging.h"
|
||||
#include "utility/utilityString.h"
|
||||
#include "utility/file/FileSystem.h"
|
||||
#include "utility/utility.h"
|
||||
|
||||
#include "data/graph/token_component/TokenComponentAggregation.h"
|
||||
#include "data/graph/token_component/TokenComponentName.h"
|
||||
#include "data/graph/Graph.h"
|
||||
#include "data/location/TokenLocation.h"
|
||||
#include "data/location/TokenLocationFile.h"
|
||||
@@ -21,8 +21,6 @@
|
||||
#include "data/type/DataType.h"
|
||||
#include "settings/ApplicationSettings.h"
|
||||
|
||||
#include "data/graph/token_component/TokenComponentName.h"
|
||||
|
||||
Storage::Storage()
|
||||
: m_sqliteStorage("data/test.sqlite")
|
||||
{
|
||||
@@ -36,6 +34,9 @@ void Storage::clear()
|
||||
{
|
||||
m_sqliteStorage.clear();
|
||||
m_tokenIndex.clear();
|
||||
|
||||
m_errorMessages.clear();
|
||||
m_errorLocationCollection.clear();
|
||||
}
|
||||
|
||||
void Storage::clearFileData(const std::set<FilePath>& filePaths)
|
||||
@@ -105,7 +106,7 @@ void Storage::onError(const ParseLocation& location, const std::string& message)
|
||||
Id errorId = m_errorMessages.size();
|
||||
|
||||
m_errorLocationCollection.addTokenLocation(
|
||||
errorId, location.filePath,
|
||||
0, errorId, location.filePath,
|
||||
location.startLineNumber, location.startColumnNumber,
|
||||
location.endLineNumber, location.endColumnNumber
|
||||
);
|
||||
@@ -867,8 +868,8 @@ std::shared_ptr<TokenLocationFile> Storage::getTokenLocationsForLinesInFile(
|
||||
|
||||
TokenLocationCollection Storage::getErrorTokenLocations(std::vector<std::string>* errorMessages) const
|
||||
{
|
||||
// TODO: Implement this one
|
||||
return TokenLocationCollection();
|
||||
errorMessages->insert(errorMessages->begin(), m_errorMessages.begin(), m_errorMessages.end());
|
||||
return m_errorLocationCollection;
|
||||
}
|
||||
|
||||
std::shared_ptr<TokenLocationFile> Storage::getTokenLocationOfParentScope(const TokenLocation* child) const
|
||||
@@ -1097,7 +1098,7 @@ void Storage::addEdgeAndAllChildrenToGraph(const Id edgeId, Graph* graph) const
|
||||
Node* sourceNode = graph->getNodeById(storageEdge.sourceNodeId);
|
||||
Node* targetNode = graph->getNodeById(storageEdge.targetNodeId);
|
||||
|
||||
graph->addEdge(edgeId, Edge::intToType(storageEdge.type), sourceNode, targetNode);
|
||||
graph->createEdge(edgeId, Edge::intToType(storageEdge.type), sourceNode, targetNode);
|
||||
}
|
||||
|
||||
void Storage::addNodeAndAllChildrenToGraph(const Id nodeId, Graph* graph) const
|
||||
@@ -1133,7 +1134,7 @@ void Storage::addNodeAndAllChildrenToGraph(const Id nodeId, Graph* graph) const
|
||||
targetNode = addNodeToGraph(storageEdge.targetNodeId, graph);
|
||||
}
|
||||
|
||||
graph->addEdge(storageEdge.id, Edge::intToType(storageEdge.type), sourceNode, targetNode);
|
||||
graph->createEdge(storageEdge.id, Edge::intToType(storageEdge.type), sourceNode, targetNode);
|
||||
|
||||
{
|
||||
std::vector<StorageEdge> edges = m_sqliteStorage.getEdgesBySourceType(storageEdge.targetNodeId, Edge::EDGE_MEMBER);
|
||||
@@ -1251,7 +1252,7 @@ void Storage::addAggregationEdgesToGraph(const Id nodeId, Graph* graph) const
|
||||
componentAggregation->addAggregationId(edgeInfo.edgeId, edgeInfo.forward);
|
||||
}
|
||||
|
||||
Edge* edge = graph->addEdge(0, Edge::EDGE_AGGREGATION, sourceNode, targetNode);
|
||||
Edge* edge = graph->createEdge(0, Edge::EDGE_AGGREGATION, sourceNode, targetNode);
|
||||
edge->addComponentAggregation(componentAggregation);
|
||||
}
|
||||
}
|
||||
@@ -1260,7 +1261,7 @@ Node* Storage::addNodeToGraph(const Id nodeId, Graph* graph) const
|
||||
{
|
||||
StorageNode storageNode = m_sqliteStorage.getNodeById(nodeId);
|
||||
|
||||
return graph->addNode(
|
||||
return graph->createNode(
|
||||
storageNode.id,
|
||||
Node::intToType(storageNode.type),
|
||||
std::make_shared<TokenComponentNameCached>(m_sqliteStorage.getNameHierarchyById(storageNode.nameId))
|
||||
|
||||
@@ -40,7 +40,7 @@ void Graph::forEachToken(std::function<void(Token*)> func) const
|
||||
forEachEdge(func);
|
||||
}
|
||||
|
||||
Node* Graph::addNode(Id id, Node::NodeType type, std::shared_ptr<TokenComponentName> nameComponent)
|
||||
Node* Graph::createNode(Id id, Node::NodeType type, std::shared_ptr<TokenComponentName> nameComponent)
|
||||
{
|
||||
Node* n = getNodeById(id);
|
||||
if (n)
|
||||
@@ -53,7 +53,7 @@ Node* Graph::addNode(Id id, Node::NodeType type, std::shared_ptr<TokenComponentN
|
||||
return node.get();
|
||||
}
|
||||
|
||||
Edge* Graph::addEdge(Id id, Edge::EdgeType type, Node* from, Node* to)
|
||||
Edge* Graph::createEdge(Id id, Edge::EdgeType type, Node* from, Node* to)
|
||||
{
|
||||
Edge* e = getEdgeById(id);
|
||||
if (e)
|
||||
|
||||
@@ -20,8 +20,8 @@ public:
|
||||
void forEachEdge(std::function<void(Edge*)> func) const;
|
||||
void forEachToken(std::function<void(Token*)> func) const;
|
||||
|
||||
Node* addNode(Id id, Node::NodeType type, std::shared_ptr<TokenComponentName> nameComponent);
|
||||
Edge* addEdge(Id id, Edge::EdgeType type, Node* from, Node* to);
|
||||
Node* createNode(Id id, Node::NodeType type, std::shared_ptr<TokenComponentName> nameComponent);
|
||||
Edge* createEdge(Id id, Edge::EdgeType type, Node* from, Node* to);
|
||||
|
||||
size_t getNodeCount() const;
|
||||
size_t getEdgeCount() const;
|
||||
|
||||
@@ -2,17 +2,6 @@
|
||||
|
||||
#include "data/location/TokenLocationLine.h"
|
||||
|
||||
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)
|
||||
, m_isStart(isStart)
|
||||
{
|
||||
}
|
||||
|
||||
TokenLocation::TokenLocation(Id locationId, Id tokenId, TokenLocationLine* line, unsigned int columnNumber, bool isStart)
|
||||
: m_id(locationId)
|
||||
, m_tokenId(tokenId)
|
||||
@@ -193,8 +182,6 @@ bool TokenLocation::isScopeTokenLocation() const
|
||||
return m_type == LOCATION_SCOPE;
|
||||
}
|
||||
|
||||
Id TokenLocation::s_locationId = 1;
|
||||
|
||||
std::ostream& operator<<(std::ostream& ostream, const TokenLocation& location)
|
||||
{
|
||||
if ((&location)->isStartTokenLocation())
|
||||
|
||||
@@ -58,8 +58,6 @@ public:
|
||||
bool isScopeTokenLocation() const;
|
||||
|
||||
private:
|
||||
static Id s_locationId; // next free own id
|
||||
|
||||
const Id m_id; // own id
|
||||
const Id m_tokenId;
|
||||
|
||||
|
||||
@@ -49,28 +49,6 @@ size_t TokenLocationCollection::getTokenLocationCount() const
|
||||
return m_locations.size();
|
||||
}
|
||||
|
||||
TokenLocation* TokenLocationCollection::addTokenLocation(
|
||||
Id tokenId, const FilePath& filePath,
|
||||
unsigned int startLineNumber, unsigned int startColumnNumber,
|
||||
unsigned int endLineNumber, unsigned int endColumnNumber)
|
||||
{
|
||||
if (startLineNumber > endLineNumber || (startLineNumber == endLineNumber && startColumnNumber > endColumnNumber))
|
||||
{
|
||||
LOG_ERROR("Can't create TokenLocation with wrong boundaries.");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
TokenLocationFile* file = createTokenLocationFile(filePath);
|
||||
TokenLocation* location =
|
||||
file->addTokenLocation(tokenId, startLineNumber, startColumnNumber, endLineNumber, endColumnNumber);
|
||||
|
||||
m_locations.emplace(location->getId(), location);
|
||||
return location;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
TokenLocation* TokenLocationCollection::addTokenLocation(
|
||||
Id locationId, Id tokenId, const FilePath& filePath,
|
||||
unsigned int startLineNumber, unsigned int startColumnNumber,
|
||||
@@ -90,8 +68,6 @@ TokenLocation* TokenLocationCollection::addTokenLocation(
|
||||
return location;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void TokenLocationCollection::removeTokenLocation(TokenLocation* location)
|
||||
{
|
||||
if (!findTokenLocationById(location->getId()))
|
||||
|
||||
@@ -31,10 +31,6 @@ public:
|
||||
const std::map<Id, TokenLocation*>& getTokenLocations() const;
|
||||
size_t getTokenLocationCount() const;
|
||||
|
||||
TokenLocation* addTokenLocation(
|
||||
Id tokenId, const FilePath& filePath,
|
||||
unsigned int startLineNumber, unsigned int startColumnNumber,
|
||||
unsigned int endLineNumber, unsigned int endColumnNumber);
|
||||
TokenLocation* addTokenLocation(
|
||||
Id locationId, Id tokenId, const FilePath& filePath,
|
||||
unsigned int startLineNumber, unsigned int startColumnNumber,
|
||||
|
||||
@@ -30,25 +30,6 @@ const FilePath& TokenLocationFile::getFilePath() const
|
||||
return m_filePath;
|
||||
}
|
||||
|
||||
TokenLocation* TokenLocationFile::addTokenLocation(
|
||||
Id tokenId,
|
||||
unsigned int startLineNumber, unsigned int startColumnNumber,
|
||||
unsigned int endLineNumber, unsigned int endColumnNumber)
|
||||
{
|
||||
TokenLocationLine* line = createTokenLocationLine(startLineNumber);
|
||||
TokenLocation* start = line->addStartTokenLocation(tokenId, startColumnNumber);
|
||||
|
||||
if (startLineNumber != endLineNumber)
|
||||
{
|
||||
line = createTokenLocationLine(endLineNumber);
|
||||
}
|
||||
|
||||
line->addEndTokenLocation(start, endColumnNumber);
|
||||
|
||||
return start;
|
||||
}
|
||||
|
||||
|
||||
TokenLocation* TokenLocationFile::addTokenLocation(
|
||||
Id locationId, Id tokenId,
|
||||
unsigned int startLineNumber, unsigned int startColumnNumber,
|
||||
@@ -67,8 +48,6 @@ TokenLocation* TokenLocationFile::addTokenLocation(
|
||||
return start;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void TokenLocationFile::removeTokenLocation(TokenLocation* location)
|
||||
{
|
||||
TokenLocationLine* line = location->getTokenLocationLine();
|
||||
|
||||
@@ -27,10 +27,6 @@ public:
|
||||
|
||||
const FilePath& getFilePath() const;
|
||||
|
||||
TokenLocation* addTokenLocation(
|
||||
Id tokenId,
|
||||
unsigned int startLineNumber, unsigned int startColumnNumber,
|
||||
unsigned int endLineNumber, unsigned int endColumnNumber);
|
||||
TokenLocation* addTokenLocation(
|
||||
Id locationId, Id tokenId,
|
||||
unsigned int startLineNumber, unsigned int startColumnNumber,
|
||||
|
||||
@@ -39,9 +39,9 @@ unsigned int TokenLocationLine::getLineNumber() const
|
||||
return m_lineNumber;
|
||||
}
|
||||
|
||||
TokenLocation* TokenLocationLine::addStartTokenLocation(Id tokenId, unsigned int columnNumber)
|
||||
TokenLocation* TokenLocationLine::addStartTokenLocation(Id locationId, Id tokenId, unsigned int columnNumber)
|
||||
{
|
||||
std::shared_ptr<TokenLocation> locationPtr = std::make_shared<TokenLocation>(tokenId, this, columnNumber, true);
|
||||
std::shared_ptr<TokenLocation> locationPtr = std::make_shared<TokenLocation>(locationId, tokenId, this, columnNumber, true);
|
||||
m_locations.emplace(columnNumber, locationPtr);
|
||||
return locationPtr.get();
|
||||
}
|
||||
@@ -54,19 +54,6 @@ TokenLocation* TokenLocationLine::addEndTokenLocation(TokenLocation* start, unsi
|
||||
return locationPtr.get();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
TokenLocation* TokenLocationLine::addStartTokenLocation(Id locationId, Id tokenId, unsigned int columnNumber)
|
||||
{
|
||||
std::shared_ptr<TokenLocation> locationPtr = std::make_shared<TokenLocation>(locationId, tokenId, this, columnNumber, true);
|
||||
m_locations.emplace(columnNumber, locationPtr);
|
||||
return locationPtr.get();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void TokenLocationLine::removeTokenLocation(TokenLocation* location)
|
||||
{
|
||||
TokenLocationMapType::iterator it = m_locations.find(location->getColumnNumber());
|
||||
|
||||
@@ -30,9 +30,8 @@ public:
|
||||
|
||||
unsigned int getLineNumber() const;
|
||||
|
||||
TokenLocation* addStartTokenLocation(Id tokenId, unsigned int columnNumber);
|
||||
TokenLocation* addEndTokenLocation(TokenLocation* start, unsigned int columnNumber);
|
||||
TokenLocation* addStartTokenLocation(Id locationId, Id tokenId, unsigned int columnNumber);
|
||||
TokenLocation* addEndTokenLocation(TokenLocation* start, unsigned int columnNumber);
|
||||
void removeTokenLocation(TokenLocation* location);
|
||||
|
||||
TokenLocation* getTokenLocationById(Id id) const;
|
||||
|
||||
+16
-16
@@ -254,8 +254,8 @@ public:
|
||||
void test_graph_saves_nodes()
|
||||
{
|
||||
Graph graph;
|
||||
Node* a = graph.addNode(1, Node::NODE_UNDEFINED, std::make_shared<TokenComponentNameCached>(utility::splitToVector("A", "::")));
|
||||
Node* b = graph.addNode(2, Node::NODE_UNDEFINED, std::make_shared<TokenComponentNameCached>(utility::splitToVector("B", "::")));
|
||||
Node* a = graph.createNode(1, Node::NODE_UNDEFINED, std::make_shared<TokenComponentNameCached>(utility::splitToVector("A", "::")));
|
||||
Node* b = graph.createNode(2, Node::NODE_UNDEFINED, std::make_shared<TokenComponentNameCached>(utility::splitToVector("B", "::")));
|
||||
|
||||
TS_ASSERT_EQUALS(2, graph.getNodeCount());
|
||||
TS_ASSERT_EQUALS(0, graph.getEdgeCount());
|
||||
@@ -273,10 +273,10 @@ public:
|
||||
{
|
||||
Graph graph;
|
||||
|
||||
Node* a = graph.addNode(1, Node::NODE_FUNCTION, std::make_shared<TokenComponentNameCached>(utility::splitToVector("A", "::")));
|
||||
Node* b = graph.addNode(2, Node::NODE_FUNCTION, std::make_shared<TokenComponentNameCached>(utility::splitToVector("B", "::")));
|
||||
Node* a = graph.createNode(1, Node::NODE_FUNCTION, std::make_shared<TokenComponentNameCached>(utility::splitToVector("A", "::")));
|
||||
Node* b = graph.createNode(2, Node::NODE_FUNCTION, std::make_shared<TokenComponentNameCached>(utility::splitToVector("B", "::")));
|
||||
|
||||
Edge* e = graph.addEdge(3, Edge::EDGE_CALL, a, b);
|
||||
Edge* e = graph.createEdge(3, Edge::EDGE_CALL, a, b);
|
||||
|
||||
TS_ASSERT_EQUALS(2, graph.getNodeCount());
|
||||
TS_ASSERT_EQUALS(1, graph.getEdgeCount());
|
||||
@@ -289,8 +289,8 @@ public:
|
||||
{
|
||||
Graph graph;
|
||||
|
||||
Node* a = graph.addNode(1, Node::NODE_UNDEFINED, std::make_shared<TokenComponentNameCached>(utility::splitToVector("A", "::")));
|
||||
graph.addNode(2, Node::NODE_UNDEFINED, std::make_shared<TokenComponentNameCached>(utility::splitToVector("B", "::")));
|
||||
Node* a = graph.createNode(1, Node::NODE_UNDEFINED, std::make_shared<TokenComponentNameCached>(utility::splitToVector("A", "::")));
|
||||
graph.createNode(2, Node::NODE_UNDEFINED, std::make_shared<TokenComponentNameCached>(utility::splitToVector("B", "::")));
|
||||
|
||||
TS_ASSERT_EQUALS(2, graph.getNodeCount());
|
||||
TS_ASSERT_EQUALS(0, graph.getEdgeCount());
|
||||
@@ -304,16 +304,16 @@ public:
|
||||
{
|
||||
Graph graph;
|
||||
|
||||
Node* a = graph.addNode(1, Node::NODE_UNDEFINED, std::make_shared<TokenComponentNameCached>(utility::splitToVector("A", "::")));
|
||||
Node* b = graph.addNode(2, Node::NODE_UNDEFINED, std::make_shared<TokenComponentNameCached>(utility::splitToVector("B", "::")));
|
||||
Node* c = graph.addNode(3, Node::NODE_UNDEFINED, std::make_shared<TokenComponentNameCached>(utility::splitToVector("C", "::")));
|
||||
Node* d = graph.addNode(4, Node::NODE_UNDEFINED, std::make_shared<TokenComponentNameCached>(utility::splitToVector("D", "::")));
|
||||
Node* e = graph.addNode(5, Node::NODE_UNDEFINED, std::make_shared<TokenComponentNameCached>(utility::splitToVector("E", "::")));
|
||||
Node* a = graph.createNode(1, Node::NODE_UNDEFINED, std::make_shared<TokenComponentNameCached>(utility::splitToVector("A", "::")));
|
||||
Node* b = graph.createNode(2, Node::NODE_UNDEFINED, std::make_shared<TokenComponentNameCached>(utility::splitToVector("B", "::")));
|
||||
Node* c = graph.createNode(3, Node::NODE_UNDEFINED, std::make_shared<TokenComponentNameCached>(utility::splitToVector("C", "::")));
|
||||
Node* d = graph.createNode(4, Node::NODE_UNDEFINED, std::make_shared<TokenComponentNameCached>(utility::splitToVector("D", "::")));
|
||||
Node* e = graph.createNode(5, Node::NODE_UNDEFINED, std::make_shared<TokenComponentNameCached>(utility::splitToVector("E", "::")));
|
||||
|
||||
graph.addEdge(6, Edge::EDGE_MEMBER, a, b);
|
||||
graph.addEdge(7, Edge::EDGE_MEMBER, a, c);
|
||||
graph.addEdge(8, Edge::EDGE_USAGE, c, d);
|
||||
graph.addEdge(9, Edge::EDGE_MEMBER, b, e);
|
||||
graph.createEdge(6, Edge::EDGE_MEMBER, a, b);
|
||||
graph.createEdge(7, Edge::EDGE_MEMBER, a, c);
|
||||
graph.createEdge(8, Edge::EDGE_USAGE, c, d);
|
||||
graph.createEdge(9, Edge::EDGE_MEMBER, b, e);
|
||||
|
||||
TS_ASSERT_EQUALS(5, graph.getNodeCount());
|
||||
TS_ASSERT_EQUALS(4, graph.getEdgeCount());
|
||||
|
||||
@@ -11,7 +11,7 @@ public:
|
||||
void test_token_locations_get_created_with_other_end()
|
||||
{
|
||||
TokenLocationCollection collection;
|
||||
TokenLocation* a = collection.addTokenLocation(1, "file.c", 2, 3, 4, 5);
|
||||
TokenLocation* a = collection.addTokenLocation(1, 1, "file.c", 2, 3, 4, 5);
|
||||
|
||||
TS_ASSERT(a);
|
||||
TS_ASSERT(a->isStartTokenLocation());
|
||||
@@ -33,8 +33,8 @@ public:
|
||||
void test_token_locations_do_not_get_created_with_wrong_input()
|
||||
{
|
||||
TokenLocationCollection collection;
|
||||
TokenLocation* a = collection.addTokenLocation(1, "file.c", 2, 3, 2, 1);
|
||||
TokenLocation* b = collection.addTokenLocation(1, "file.c", 4, 1, 1, 10);
|
||||
TokenLocation* a = collection.addTokenLocation(1, 1, "file.c", 2, 3, 2, 1);
|
||||
TokenLocation* b = collection.addTokenLocation(2, 1, "file.c", 4, 1, 1, 10);
|
||||
|
||||
TS_ASSERT(!a);
|
||||
TS_ASSERT(!b);
|
||||
@@ -43,9 +43,9 @@ public:
|
||||
void test_token_locations_get_unique_id_but_both_ends_have_the_same()
|
||||
{
|
||||
TokenLocationCollection collection;
|
||||
TokenLocation* a = collection.addTokenLocation(1, "file.c", 1, 1, 1, 1);
|
||||
TokenLocation* b = collection.addTokenLocation(2, "file.c", 1, 1, 1, 1);
|
||||
TokenLocation* c = collection.addTokenLocation(3, "file.c", 1, 1, 1, 1);
|
||||
TokenLocation* a = collection.addTokenLocation(1, 1, "file.c", 1, 1, 1, 1);
|
||||
TokenLocation* b = collection.addTokenLocation(2, 2, "file.c", 1, 1, 1, 1);
|
||||
TokenLocation* c = collection.addTokenLocation(3, 3, "file.c", 1, 1, 1, 1);
|
||||
|
||||
TS_ASSERT_EQUALS(1, collection.getTokenLocationFileCount());
|
||||
TS_ASSERT_EQUALS(3, collection.getTokenLocationCount());
|
||||
@@ -62,7 +62,7 @@ public:
|
||||
void test_token_locations_have_right_file_path_line_column_and_token_id()
|
||||
{
|
||||
TokenLocationCollection collection;
|
||||
TokenLocation* a = collection.addTokenLocation(1, "file.c", 2, 3, 4, 5);
|
||||
TokenLocation* a = collection.addTokenLocation(1, 1, "file.c", 2, 3, 4, 5);
|
||||
|
||||
TS_ASSERT_EQUALS(1, a->getTokenId());
|
||||
TS_ASSERT_EQUALS(2, a->getLineNumber());
|
||||
@@ -75,8 +75,8 @@ public:
|
||||
void test_finding_token_locations_by_id()
|
||||
{
|
||||
TokenLocationCollection collection;
|
||||
TokenLocation* a = collection.addTokenLocation(1, "file.c", 2, 3, 4, 5);
|
||||
TokenLocation* b = collection.addTokenLocation(6, "file.c", 7, 8, 9, 10);
|
||||
TokenLocation* a = collection.addTokenLocation(1, 1, "file.c", 2, 3, 4, 5);
|
||||
TokenLocation* b = collection.addTokenLocation(2, 6, "file.c", 7, 8, 9, 10);
|
||||
|
||||
TS_ASSERT_EQUALS(a, collection.findTokenLocationById(a->getId()));
|
||||
TS_ASSERT_EQUALS(b, collection.findTokenLocationById(b->getId()));
|
||||
@@ -85,10 +85,10 @@ public:
|
||||
void test_removing_token_locations()
|
||||
{
|
||||
TokenLocationCollection collection;
|
||||
TokenLocation* a = collection.addTokenLocation(1, "file.c", 2, 3, 4, 5);
|
||||
TokenLocation* b = collection.addTokenLocation(1, "file.c", 3, 3, 4, 5);
|
||||
TokenLocation* c = collection.addTokenLocation(1, "file.c", 1, 3, 5, 5);
|
||||
TokenLocation* d = collection.addTokenLocation(1, "file2.c", 1, 3, 5, 5);
|
||||
TokenLocation* a = collection.addTokenLocation(1, 1, "file.c", 2, 3, 4, 5);
|
||||
TokenLocation* b = collection.addTokenLocation(2, 1, "file.c", 3, 3, 4, 5);
|
||||
TokenLocation* c = collection.addTokenLocation(3, 1, "file.c", 1, 3, 5, 5);
|
||||
TokenLocation* d = collection.addTokenLocation(4, 1, "file2.c", 1, 3, 5, 5);
|
||||
|
||||
TS_ASSERT_EQUALS(2, collection.getTokenLocationFileCount());
|
||||
TS_ASSERT_EQUALS(4, collection.getTokenLocationCount());
|
||||
@@ -114,10 +114,10 @@ public:
|
||||
void test_creating_plain_copy_of_all_locations_in_line_range()
|
||||
{
|
||||
TokenLocationCollection collection;
|
||||
TokenLocation* a = collection.addTokenLocation(1, "file.c", 2, 3, 4, 5);
|
||||
TokenLocation* b = collection.addTokenLocation(1, "file.c", 3, 3, 4, 5);
|
||||
TokenLocation* c = collection.addTokenLocation(1, "file.c", 1, 3, 5, 5);
|
||||
TokenLocation* d = collection.addTokenLocation(1, "file.c", 1, 5, 4, 5);
|
||||
TokenLocation* a = collection.addTokenLocation(1, 1, "file.c", 2, 3, 4, 5);
|
||||
TokenLocation* b = collection.addTokenLocation(2, 1, "file.c", 3, 3, 4, 5);
|
||||
TokenLocation* c = collection.addTokenLocation(3, 1, "file.c", 1, 3, 5, 5);
|
||||
TokenLocation* d = collection.addTokenLocation(4, 1, "file.c", 1, 5, 4, 5);
|
||||
|
||||
Id ida = a->getId();
|
||||
Id idb = b->getId();
|
||||
|
||||
Reference in New Issue
Block a user