Commit 35b4420f authored by Nikolai Kosjar's avatar Nikolai Kosjar

Editor: Add further Use::isInvalid() guards

Task-number: QTCREATORBUG-8738

Change-Id: I297731f15bd9001f7edc83c956a15ef660929dc7
Reviewed-by: default avatarMitch Curtis <mitch.curtis@digia.com>
Reviewed-by: default avatarErik Verbruggen <erik.verbruggen@digia.com>
parent 9f94a8b3
...@@ -913,6 +913,8 @@ Utils::ChangeSet FunctionDeclDefLink::changes(const Snapshot &snapshot, int targ ...@@ -913,6 +913,8 @@ Utils::ChangeSet FunctionDeclDefLink::changes(const Snapshot &snapshot, int targ
it.next(); it.next();
const QList<SemanticInfo::Use> &uses = localSymbols.uses.value(it.key()); const QList<SemanticInfo::Use> &uses = localSymbols.uses.value(it.key());
foreach (const SemanticInfo::Use &use, uses) { foreach (const SemanticInfo::Use &use, uses) {
if (use.isInvalid())
continue;
const int useStart = targetFile->position(use.line, use.column); const int useStart = targetFile->position(use.line, use.column);
if (useStart <= endOfArguments) if (useStart <= endOfArguments)
continue; continue;
......
...@@ -1096,6 +1096,9 @@ void ExtractFunction::match(const CppQuickFixInterface &interface, QuickFixOpera ...@@ -1096,6 +1096,9 @@ void ExtractFunction::match(const CppQuickFixInterface &interface, QuickFixOpera
bool usedInsideExtraction = false; bool usedInsideExtraction = false;
const QList<SemanticInfo::Use> &uses = it.value(); const QList<SemanticInfo::Use> &uses = it.value();
foreach (const SemanticInfo::Use &use, uses) { foreach (const SemanticInfo::Use &use, uses) {
if (use.isInvalid())
continue;
const int position = file->position(use.line, use.column); const int position = file->position(use.line, use.column);
if (position < analyser.m_extractionStart) if (position < analyser.m_extractionStart)
usedBeforeExtraction = true; usedBeforeExtraction = true;
......
...@@ -1104,7 +1104,7 @@ static const int chunkSize = 50; ...@@ -1104,7 +1104,7 @@ static const int chunkSize = 50;
void CheckSymbols::addUse(const Use &use) void CheckSymbols::addUse(const Use &use)
{ {
if (!use.line) if (use.isInvalid())
return; return;
if (! enclosingFunctionDefinition()) { if (! enclosingFunctionDefinition()) {
......
...@@ -79,8 +79,8 @@ public: ...@@ -79,8 +79,8 @@ public:
for (int i = from; i < to; ++i) { for (int i = from; i < to; ++i) {
const Use use = future.resultAt(i); const Use use = future.resultAt(i);
if (! use.line) if (use.isInvalid())
continue; // skip it, it's an invalid use. continue;
const int blockNumber = use.line - 1; const int blockNumber = use.line - 1;
chunks[blockNumber].append(use); chunks[blockNumber].append(use);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment