Commit 804eb717 authored by Orgad Shaneh's avatar Orgad Shaneh Committed by Orgad Shaneh
Browse files

C++: Avoid repetitive calls



Change-Id: I6f04b98c14567d344907ac635df7eeee2f7aeac7
Reviewed-by: default avatarNikolai Kosjar <nikolai.kosjar@digia.com>
parent 480e8134
...@@ -206,45 +206,47 @@ bool FindUsages::checkCandidates(const QList<LookupItem> &candidates) const ...@@ -206,45 +206,47 @@ bool FindUsages::checkCandidates(const QList<LookupItem> &candidates) const
return false; return false;
} }
if (isLocalScope(_declSymbol->enclosingScope()) || isLocalScope(s->enclosingScope())) { Scope *declEnclosingScope = _declSymbol->enclosingScope();
if (_declSymbol->isClass() && _declSymbol->enclosingScope()->isTemplate() Scope *enclosingScope = s->enclosingScope();
&& s->isClass() && s->enclosingScope()->isTemplate()) { if (isLocalScope(declEnclosingScope) || isLocalScope(enclosingScope)) {
if (_declSymbol->isClass() && declEnclosingScope->isTemplate()
&& s->isClass() && enclosingScope->isTemplate()) {
// for definition of functions of class defined outside the class definition // for definition of functions of class defined outside the class definition
Scope *templEnclosingDeclSymbol = _declSymbol->enclosingScope(); Scope *templEnclosingDeclSymbol = declEnclosingScope;
Scope *scopeOfTemplEnclosingDeclSymbol Scope *scopeOfTemplEnclosingDeclSymbol
= templEnclosingDeclSymbol->enclosingScope(); = templEnclosingDeclSymbol->enclosingScope();
Scope *templEnclosingCandidateSymbol = s->enclosingScope(); Scope *templEnclosingCandidateSymbol = enclosingScope;
Scope *scopeOfTemplEnclosingCandidateSymbol Scope *scopeOfTemplEnclosingCandidateSymbol
= templEnclosingCandidateSymbol->enclosingScope(); = templEnclosingCandidateSymbol->enclosingScope();
if (scopeOfTemplEnclosingCandidateSymbol != scopeOfTemplEnclosingDeclSymbol) if (scopeOfTemplEnclosingCandidateSymbol != scopeOfTemplEnclosingDeclSymbol)
return false; return false;
} else if (_declSymbol->isClass() && _declSymbol->enclosingScope()->isTemplate() } else if (_declSymbol->isClass() && declEnclosingScope->isTemplate()
&& s->enclosingScope()->isClass() && enclosingScope->isClass()
&& s->enclosingScope()->enclosingScope()->isTemplate()) { && enclosingScope->enclosingScope()->isTemplate()) {
// for declaration inside template class // for declaration inside template class
Scope *templEnclosingDeclSymbol = _declSymbol->enclosingScope(); Scope *templEnclosingDeclSymbol = declEnclosingScope;
Scope *scopeOfTemplEnclosingDeclSymbol Scope *scopeOfTemplEnclosingDeclSymbol
= templEnclosingDeclSymbol->enclosingScope(); = templEnclosingDeclSymbol->enclosingScope();
Scope *templEnclosingCandidateSymbol = s->enclosingScope()->enclosingScope(); Scope *templEnclosingCandidateSymbol = enclosingScope->enclosingScope();
Scope *scopeOfTemplEnclosingCandidateSymbol Scope *scopeOfTemplEnclosingCandidateSymbol
= templEnclosingCandidateSymbol->enclosingScope(); = templEnclosingCandidateSymbol->enclosingScope();
if (scopeOfTemplEnclosingCandidateSymbol != scopeOfTemplEnclosingDeclSymbol) if (scopeOfTemplEnclosingCandidateSymbol != scopeOfTemplEnclosingDeclSymbol)
return false; return false;
} else if (s->enclosingScope()->isTemplate() && ! _declSymbol->isTypenameArgument()) { } else if (enclosingScope->isTemplate() && ! _declSymbol->isTypenameArgument()) {
if (_declSymbol->enclosingScope()->isTemplate()) { if (declEnclosingScope->isTemplate()) {
if (s->enclosingScope()->enclosingScope() != _declSymbol->enclosingScope()->enclosingScope()) if (enclosingScope->enclosingScope() != declEnclosingScope->enclosingScope())
return false; return false;
} else { } else {
if (s->enclosingScope()->enclosingScope() != _declSymbol->enclosingScope()) if (enclosingScope->enclosingScope() != declEnclosingScope)
return false; return false;
} }
} else if (_declSymbol->enclosingScope()->isTemplate() && s->isTemplate()) { } else if (declEnclosingScope->isTemplate() && s->isTemplate()) {
if (_declSymbol->enclosingScope()->enclosingScope() != s->enclosingScope()) if (declEnclosingScope->enclosingScope() != enclosingScope)
return false; return false;
} else if (! s->isUsingDeclaration() } else if (! s->isUsingDeclaration()
&& s->enclosingScope() != _declSymbol->enclosingScope()) { && enclosingScope != declEnclosingScope) {
return false; return false;
} }
} }
......
Supports Markdown
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