forked from qt-creator/qt-creator
Deprecated the current LookupContext.
This commit is contained in:
@@ -27,7 +27,7 @@
|
||||
**
|
||||
**************************************************************************/
|
||||
|
||||
#include "LookupContext.h"
|
||||
#include "DeprecatedLookupContext.h"
|
||||
#include "ResolveExpression.h"
|
||||
#include "Overview.h"
|
||||
#include "CppBindings.h"
|
||||
@@ -53,12 +53,12 @@ using namespace CPlusPlus;
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
// LookupContext
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
LookupContext::LookupContext(Control *control)
|
||||
DeprecatedLookupContext::DeprecatedLookupContext(Control *control)
|
||||
: _control(control),
|
||||
_symbol(0)
|
||||
{ }
|
||||
|
||||
LookupContext::LookupContext(Symbol *symbol,
|
||||
DeprecatedLookupContext::DeprecatedLookupContext(Symbol *symbol,
|
||||
Document::Ptr expressionDocument,
|
||||
Document::Ptr thisDocument,
|
||||
const Snapshot &snapshot)
|
||||
@@ -71,28 +71,28 @@ LookupContext::LookupContext(Symbol *symbol,
|
||||
_visibleScopes = buildVisibleScopes();
|
||||
}
|
||||
|
||||
bool LookupContext::isValid() const
|
||||
bool DeprecatedLookupContext::isValid() const
|
||||
{ return _control != 0; }
|
||||
|
||||
Control *LookupContext::control() const
|
||||
Control *DeprecatedLookupContext::control() const
|
||||
{ return _control; }
|
||||
|
||||
Symbol *LookupContext::symbol() const
|
||||
Symbol *DeprecatedLookupContext::symbol() const
|
||||
{ return _symbol; }
|
||||
|
||||
Document::Ptr LookupContext::expressionDocument() const
|
||||
Document::Ptr DeprecatedLookupContext::expressionDocument() const
|
||||
{ return _expressionDocument; }
|
||||
|
||||
Document::Ptr LookupContext::thisDocument() const
|
||||
Document::Ptr DeprecatedLookupContext::thisDocument() const
|
||||
{ return _thisDocument; }
|
||||
|
||||
Document::Ptr LookupContext::document(const QString &fileName) const
|
||||
Document::Ptr DeprecatedLookupContext::document(const QString &fileName) const
|
||||
{ return _snapshot.document(fileName); }
|
||||
|
||||
Snapshot LookupContext::snapshot() const
|
||||
Snapshot DeprecatedLookupContext::snapshot() const
|
||||
{ return _snapshot; }
|
||||
|
||||
bool LookupContext::maybeValidSymbol(Symbol *symbol,
|
||||
bool DeprecatedLookupContext::maybeValidSymbol(Symbol *symbol,
|
||||
ResolveMode mode,
|
||||
const QList<Symbol *> &candidates)
|
||||
{
|
||||
@@ -107,7 +107,7 @@ bool LookupContext::maybeValidSymbol(Symbol *symbol,
|
||||
return false;
|
||||
}
|
||||
|
||||
QList<Scope *> LookupContext::resolveNestedNameSpecifier(const QualifiedNameId *q,
|
||||
QList<Scope *> DeprecatedLookupContext::resolveNestedNameSpecifier(const QualifiedNameId *q,
|
||||
const QList<Scope *> &visibleScopes) const
|
||||
{
|
||||
QList<Symbol *> candidates;
|
||||
@@ -135,7 +135,7 @@ QList<Scope *> LookupContext::resolveNestedNameSpecifier(const QualifiedNameId *
|
||||
return scopes;
|
||||
}
|
||||
|
||||
QList<Symbol *> LookupContext::resolveQualifiedNameId(const QualifiedNameId *q,
|
||||
QList<Symbol *> DeprecatedLookupContext::resolveQualifiedNameId(const QualifiedNameId *q,
|
||||
const QList<Scope *> &visibleScopes,
|
||||
ResolveMode mode) const
|
||||
{
|
||||
@@ -203,7 +203,7 @@ QList<Symbol *> LookupContext::resolveQualifiedNameId(const QualifiedNameId *q,
|
||||
return candidates;
|
||||
}
|
||||
|
||||
QList<Symbol *> LookupContext::resolveOperatorNameId(const OperatorNameId *opId,
|
||||
QList<Symbol *> DeprecatedLookupContext::resolveOperatorNameId(const OperatorNameId *opId,
|
||||
const QList<Scope *> &visibleScopes,
|
||||
ResolveMode) const
|
||||
{
|
||||
@@ -224,7 +224,7 @@ QList<Symbol *> LookupContext::resolveOperatorNameId(const OperatorNameId *opId,
|
||||
return candidates;
|
||||
}
|
||||
|
||||
QList<Symbol *> LookupContext::resolve(const Name *name, const QList<Scope *> &visibleScopes,
|
||||
QList<Symbol *> DeprecatedLookupContext::resolve(const Name *name, const QList<Scope *> &visibleScopes,
|
||||
ResolveMode mode) const
|
||||
{
|
||||
QList<Symbol *> candidates;
|
||||
@@ -297,7 +297,7 @@ QList<Symbol *> LookupContext::resolve(const Name *name, const QList<Scope *> &v
|
||||
return candidates;
|
||||
}
|
||||
|
||||
const Identifier *LookupContext::identifier(const Name *name) const
|
||||
const Identifier *DeprecatedLookupContext::identifier(const Name *name) const
|
||||
{
|
||||
if (name)
|
||||
return name->identifier();
|
||||
@@ -305,7 +305,7 @@ const Identifier *LookupContext::identifier(const Name *name) const
|
||||
return 0;
|
||||
}
|
||||
|
||||
void LookupContext::buildVisibleScopes_helper(Document::Ptr doc, QList<Scope *> *scopes,
|
||||
void DeprecatedLookupContext::buildVisibleScopes_helper(Document::Ptr doc, QList<Scope *> *scopes,
|
||||
QSet<QString> *processed)
|
||||
{
|
||||
if (doc && ! processed->contains(doc->fileName())) {
|
||||
@@ -321,7 +321,7 @@ void LookupContext::buildVisibleScopes_helper(Document::Ptr doc, QList<Scope *>
|
||||
}
|
||||
}
|
||||
|
||||
QList<Scope *> LookupContext::buildVisibleScopes()
|
||||
QList<Scope *> DeprecatedLookupContext::buildVisibleScopes()
|
||||
{
|
||||
QList<Scope *> scopes;
|
||||
|
||||
@@ -355,10 +355,10 @@ QList<Scope *> LookupContext::buildVisibleScopes()
|
||||
return scopes;
|
||||
}
|
||||
|
||||
QList<Scope *> LookupContext::visibleScopes(const LookupItem &result) const
|
||||
QList<Scope *> DeprecatedLookupContext::visibleScopes(const LookupItem &result) const
|
||||
{ return visibleScopes(result.lastVisibleSymbol()); }
|
||||
|
||||
QList<Scope *> LookupContext::visibleScopes(Symbol *symbol) const
|
||||
QList<Scope *> DeprecatedLookupContext::visibleScopes(Symbol *symbol) const
|
||||
{
|
||||
QList<Scope *> scopes;
|
||||
if (symbol) {
|
||||
@@ -370,7 +370,7 @@ QList<Scope *> LookupContext::visibleScopes(Symbol *symbol) const
|
||||
return scopes;
|
||||
}
|
||||
|
||||
void LookupContext::expandEnumOrAnonymousSymbol(ScopedSymbol *scopedSymbol,
|
||||
void DeprecatedLookupContext::expandEnumOrAnonymousSymbol(ScopedSymbol *scopedSymbol,
|
||||
QList<Scope *> *expandedScopes) const
|
||||
{
|
||||
if (! scopedSymbol || expandedScopes->contains(scopedSymbol->members()))
|
||||
@@ -395,21 +395,21 @@ void LookupContext::expandEnumOrAnonymousSymbol(ScopedSymbol *scopedSymbol,
|
||||
}
|
||||
}
|
||||
|
||||
QList<Scope *> LookupContext::expand(const QList<Scope *> &scopes) const
|
||||
QList<Scope *> DeprecatedLookupContext::expand(const QList<Scope *> &scopes) const
|
||||
{
|
||||
QList<Scope *> expanded;
|
||||
expand(scopes, &expanded);
|
||||
return expanded;
|
||||
}
|
||||
|
||||
void LookupContext::expand(const QList<Scope *> &scopes, QList<Scope *> *expandedScopes) const
|
||||
void DeprecatedLookupContext::expand(const QList<Scope *> &scopes, QList<Scope *> *expandedScopes) const
|
||||
{
|
||||
for (int i = 0; i < scopes.size(); ++i) {
|
||||
expand(scopes.at(i), scopes, expandedScopes);
|
||||
}
|
||||
}
|
||||
|
||||
void LookupContext::expandNamespace(Namespace *ns,
|
||||
void DeprecatedLookupContext::expandNamespace(Namespace *ns,
|
||||
const QList<Scope *> &visibleScopes,
|
||||
QList<Scope *> *expandedScopes) const
|
||||
{
|
||||
@@ -445,7 +445,7 @@ void LookupContext::expandNamespace(Namespace *ns,
|
||||
}
|
||||
}
|
||||
|
||||
void LookupContext::expandClass(Class *klass,
|
||||
void DeprecatedLookupContext::expandClass(Class *klass,
|
||||
const QList<Scope *> &visibleScopes,
|
||||
QList<Scope *> *expandedScopes) const
|
||||
{
|
||||
@@ -493,7 +493,7 @@ void LookupContext::expandClass(Class *klass,
|
||||
}
|
||||
}
|
||||
|
||||
void LookupContext::expandBlock(Block *blockSymbol,
|
||||
void DeprecatedLookupContext::expandBlock(Block *blockSymbol,
|
||||
const QList<Scope *> &visibleScopes,
|
||||
QList<Scope *> *expandedScopes) const
|
||||
{
|
||||
@@ -511,7 +511,7 @@ void LookupContext::expandBlock(Block *blockSymbol,
|
||||
}
|
||||
}
|
||||
|
||||
void LookupContext::expandFunction(Function *function,
|
||||
void DeprecatedLookupContext::expandFunction(Function *function,
|
||||
const QList<Scope *> &visibleScopes,
|
||||
QList<Scope *> *expandedScopes) const
|
||||
{
|
||||
@@ -536,7 +536,7 @@ void LookupContext::expandFunction(Function *function,
|
||||
}
|
||||
}
|
||||
|
||||
void LookupContext::expandObjCMethod(ObjCMethod *method,
|
||||
void DeprecatedLookupContext::expandObjCMethod(ObjCMethod *method,
|
||||
const QList<Scope *> &,
|
||||
QList<Scope *> *expandedScopes) const
|
||||
{
|
||||
@@ -544,7 +544,7 @@ void LookupContext::expandObjCMethod(ObjCMethod *method,
|
||||
expandedScopes->append(method->arguments());
|
||||
}
|
||||
|
||||
void LookupContext::expandObjCClass(ObjCClass *klass,
|
||||
void DeprecatedLookupContext::expandObjCClass(ObjCClass *klass,
|
||||
const QList<Scope *> &visibleScopes,
|
||||
QList<Scope *> *expandedScopes) const
|
||||
{
|
||||
@@ -592,7 +592,7 @@ void LookupContext::expandObjCClass(ObjCClass *klass,
|
||||
}
|
||||
}
|
||||
|
||||
void LookupContext::expandObjCProtocol(ObjCProtocol *protocol, const QList<Scope *> &visibleScopes, QList<Scope *> *expandedScopes) const
|
||||
void DeprecatedLookupContext::expandObjCProtocol(ObjCProtocol *protocol, const QList<Scope *> &visibleScopes, QList<Scope *> *expandedScopes) const
|
||||
{
|
||||
// First expand the protocol itself
|
||||
expand(protocol->members(), visibleScopes, expandedScopes);
|
||||
@@ -607,7 +607,7 @@ void LookupContext::expandObjCProtocol(ObjCProtocol *protocol, const QList<Scope
|
||||
}
|
||||
}
|
||||
|
||||
void LookupContext::expand(Scope *scope,
|
||||
void DeprecatedLookupContext::expand(Scope *scope,
|
||||
const QList<Scope *> &visibleScopes,
|
||||
QList<Scope *> *expandedScopes) const
|
||||
{
|
||||
@@ -666,10 +666,10 @@ static QList<ClassBinding *> visibleClassBindings(Symbol *symbol, NamespaceBindi
|
||||
return classBindings;
|
||||
}
|
||||
|
||||
Symbol *LookupContext::canonicalSymbol(Symbol *symbol,
|
||||
Symbol *DeprecatedLookupContext::canonicalSymbol(Symbol *symbol,
|
||||
NamespaceBinding *globalNamespace)
|
||||
{
|
||||
Symbol *canonicalSymbol = LookupContext::canonicalSymbol(symbol);
|
||||
Symbol *canonicalSymbol = DeprecatedLookupContext::canonicalSymbol(symbol);
|
||||
if (! canonicalSymbol)
|
||||
return 0;
|
||||
|
||||
@@ -691,7 +691,7 @@ Symbol *LookupContext::canonicalSymbol(Symbol *symbol,
|
||||
continue;
|
||||
else if (Function *f = c->type()->asFunctionType()) {
|
||||
if (f->isVirtual())
|
||||
return LookupContext::canonicalSymbol(f);
|
||||
return DeprecatedLookupContext::canonicalSymbol(f);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -702,7 +702,7 @@ Symbol *LookupContext::canonicalSymbol(Symbol *symbol,
|
||||
return canonicalSymbol;
|
||||
}
|
||||
|
||||
Symbol *LookupContext::canonicalSymbol(const QList<Symbol *> &candidates,
|
||||
Symbol *DeprecatedLookupContext::canonicalSymbol(const QList<Symbol *> &candidates,
|
||||
NamespaceBinding *globalNamespaceBinding)
|
||||
{
|
||||
if (candidates.isEmpty())
|
||||
@@ -711,7 +711,7 @@ Symbol *LookupContext::canonicalSymbol(const QList<Symbol *> &candidates,
|
||||
return canonicalSymbol(candidates.first(), globalNamespaceBinding);
|
||||
}
|
||||
|
||||
Symbol *LookupContext::canonicalSymbol(const QList<LookupItem> &results,
|
||||
Symbol *DeprecatedLookupContext::canonicalSymbol(const QList<LookupItem> &results,
|
||||
NamespaceBinding *globalNamespaceBinding)
|
||||
{
|
||||
QList<Symbol *> candidates;
|
||||
@@ -723,7 +723,7 @@ Symbol *LookupContext::canonicalSymbol(const QList<LookupItem> &results,
|
||||
}
|
||||
|
||||
|
||||
Symbol *LookupContext::canonicalSymbol(Symbol *symbol)
|
||||
Symbol *DeprecatedLookupContext::canonicalSymbol(Symbol *symbol)
|
||||
{
|
||||
Symbol *canonical = symbol;
|
||||
Class *canonicalClass = 0;
|
||||
@@ -27,8 +27,8 @@
|
||||
**
|
||||
**************************************************************************/
|
||||
|
||||
#ifndef CPLUSPLUS_LOOKUPCONTEXT_H
|
||||
#define CPLUSPLUS_LOOKUPCONTEXT_H
|
||||
#ifndef CPLUSPLUS_DEPRECATEDLOOKUPCONTEXT_H
|
||||
#define CPLUSPLUS_DEPRECATEDLOOKUPCONTEXT_H
|
||||
|
||||
#include "CppDocument.h"
|
||||
#include <FullySpecifiedType.h>
|
||||
@@ -66,12 +66,12 @@ private:
|
||||
Symbol *_lastVisibleSymbol;
|
||||
};
|
||||
|
||||
class CPLUSPLUS_EXPORT LookupContext
|
||||
class CPLUSPLUS_EXPORT DeprecatedLookupContext
|
||||
{
|
||||
public:
|
||||
LookupContext(Control *control = 0);
|
||||
DeprecatedLookupContext(Control *control = 0);
|
||||
|
||||
LookupContext(Symbol *symbol,
|
||||
DeprecatedLookupContext(Symbol *symbol,
|
||||
Document::Ptr expressionDocument,
|
||||
Document::Ptr thisDocument,
|
||||
const Snapshot &snapshot);
|
||||
@@ -238,4 +238,4 @@ uint qHash(const CPlusPlus::LookupItem &result);
|
||||
inline uint qHash(const CPlusPlus::LookupItem &item) { return CPlusPlus::qHash(item); }
|
||||
#endif
|
||||
|
||||
#endif // CPLUSPLUS_LOOKUPCONTEXT_H
|
||||
#endif // CPLUSPLUS_DEPRECATEDLOOKUPCONTEXT_H
|
||||
@@ -141,7 +141,7 @@ void FindUsages::reportResult(unsigned tokenIndex)
|
||||
|
||||
bool FindUsages::checkCandidates(const QList<Symbol *> &candidates) const
|
||||
{
|
||||
if (Symbol *canonicalSymbol = LookupContext::canonicalSymbol(candidates, _globalNamespaceBinding.data())) {
|
||||
if (Symbol *canonicalSymbol = DeprecatedLookupContext::canonicalSymbol(candidates, _globalNamespaceBinding.data())) {
|
||||
|
||||
#if 0
|
||||
Symbol *c = candidates.first();
|
||||
@@ -201,7 +201,7 @@ bool FindUsages::checkSymbol(Symbol *symbol) const
|
||||
return false;
|
||||
}
|
||||
|
||||
LookupContext FindUsages::currentContext(AST *ast)
|
||||
DeprecatedLookupContext FindUsages::currentContext(AST *ast)
|
||||
{
|
||||
unsigned line, column;
|
||||
getTokenStartPosition(ast->firstToken(), &line, &column);
|
||||
@@ -217,7 +217,7 @@ LookupContext FindUsages::currentContext(AST *ast)
|
||||
if (lastVisibleSymbol && lastVisibleSymbol == _previousContext.symbol())
|
||||
return _previousContext;
|
||||
|
||||
LookupContext ctx(lastVisibleSymbol, _exprDoc, _doc, _snapshot);
|
||||
DeprecatedLookupContext ctx(lastVisibleSymbol, _exprDoc, _doc, _snapshot);
|
||||
_previousContext = ctx;
|
||||
return _previousContext;
|
||||
}
|
||||
@@ -235,7 +235,7 @@ bool FindUsages::visit(MemInitializerAST *ast)
|
||||
|
||||
SimpleNameAST *simple = ast->name->asSimpleName();
|
||||
if (identifier(simple->identifier_token) == _id) {
|
||||
LookupContext context = currentContext(ast);
|
||||
DeprecatedLookupContext context = currentContext(ast);
|
||||
const QList<Symbol *> candidates = context.resolve(simple->name);
|
||||
reportResult(simple->identifier_token, candidates);
|
||||
}
|
||||
@@ -365,7 +365,7 @@ bool FindUsages::visit(EnumeratorAST *ast)
|
||||
{
|
||||
const Identifier *id = identifier(ast->identifier_token);
|
||||
if (id == _id) {
|
||||
LookupContext context = currentContext(ast);
|
||||
DeprecatedLookupContext context = currentContext(ast);
|
||||
const QList<Symbol *> candidates = context.resolve(control()->nameId(id));
|
||||
reportResult(ast->identifier_token, candidates);
|
||||
}
|
||||
@@ -379,7 +379,7 @@ bool FindUsages::visit(SimpleNameAST *ast)
|
||||
{
|
||||
const Identifier *id = identifier(ast->identifier_token);
|
||||
if (id == _id) {
|
||||
LookupContext context = currentContext(ast);
|
||||
DeprecatedLookupContext context = currentContext(ast);
|
||||
const QList<Symbol *> candidates = context.resolve(ast->name);
|
||||
reportResult(ast->identifier_token, candidates);
|
||||
}
|
||||
@@ -391,7 +391,7 @@ bool FindUsages::visit(DestructorNameAST *ast)
|
||||
{
|
||||
const Identifier *id = identifier(ast->identifier_token);
|
||||
if (id == _id) {
|
||||
LookupContext context = currentContext(ast);
|
||||
DeprecatedLookupContext context = currentContext(ast);
|
||||
const QList<Symbol *> candidates = context.resolve(ast->name);
|
||||
reportResult(ast->identifier_token, candidates);
|
||||
}
|
||||
@@ -402,7 +402,7 @@ bool FindUsages::visit(DestructorNameAST *ast)
|
||||
bool FindUsages::visit(TemplateIdAST *ast)
|
||||
{
|
||||
if (_id == identifier(ast->identifier_token)) {
|
||||
LookupContext context = currentContext(ast);
|
||||
DeprecatedLookupContext context = currentContext(ast);
|
||||
const QList<Symbol *> candidates = context.resolve(ast->name);
|
||||
reportResult(ast->identifier_token, candidates);
|
||||
}
|
||||
@@ -478,7 +478,7 @@ bool FindUsages::visit(ObjCSelectorAST *ast)
|
||||
if (ast->name) {
|
||||
const Identifier *id = ast->name->identifier();
|
||||
if (id == _id) {
|
||||
LookupContext context = currentContext(ast);
|
||||
DeprecatedLookupContext context = currentContext(ast);
|
||||
const QList<Symbol *> candidates = context.resolve(ast->name);
|
||||
reportResult(ast->firstToken(), candidates);
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
#ifndef FINDUSAGES_H
|
||||
#define FINDUSAGES_H
|
||||
|
||||
#include "LookupContext.h"
|
||||
#include "DeprecatedLookupContext.h"
|
||||
#include "CppDocument.h"
|
||||
#include "CppBindings.h"
|
||||
#include "Semantic.h"
|
||||
@@ -82,7 +82,7 @@ protected:
|
||||
bool checkScope(Symbol *symbol, Symbol *otherSymbol) const;
|
||||
void checkExpression(unsigned startToken, unsigned endToken);
|
||||
|
||||
LookupContext currentContext(AST *ast);
|
||||
DeprecatedLookupContext currentContext(AST *ast);
|
||||
|
||||
void ensureNameIsValid(NameAST *ast);
|
||||
|
||||
@@ -116,7 +116,7 @@ private:
|
||||
QList<QualifiedNameAST *> _qualifiedNameStack;
|
||||
QList<int> _references;
|
||||
QList<Usage> _usages;
|
||||
LookupContext _previousContext;
|
||||
DeprecatedLookupContext _previousContext;
|
||||
int _inSimpleDeclaration;
|
||||
bool _inQProperty;
|
||||
QSet<unsigned> _processed;
|
||||
|
||||
@@ -47,7 +47,7 @@ namespace {
|
||||
class ApplySubstitution
|
||||
{
|
||||
public:
|
||||
ApplySubstitution(const LookupContext &context, Symbol *symbol, const GenTemplateInstance::Substitution &substitution);
|
||||
ApplySubstitution(const DeprecatedLookupContext &context, Symbol *symbol, const GenTemplateInstance::Substitution &substitution);
|
||||
~ApplySubstitution();
|
||||
|
||||
Control *control() const { return context.control(); }
|
||||
@@ -309,14 +309,14 @@ private:
|
||||
};
|
||||
|
||||
public: // attributes
|
||||
LookupContext context;
|
||||
DeprecatedLookupContext context;
|
||||
Symbol *symbol;
|
||||
GenTemplateInstance::Substitution substitution;
|
||||
ApplyToType applyToType;
|
||||
ApplyToName applyToName;
|
||||
};
|
||||
|
||||
ApplySubstitution::ApplySubstitution(const LookupContext &context, Symbol *symbol,
|
||||
ApplySubstitution::ApplySubstitution(const DeprecatedLookupContext &context, Symbol *symbol,
|
||||
const GenTemplateInstance::Substitution &substitution)
|
||||
: context(context), symbol(symbol),
|
||||
substitution(substitution),
|
||||
@@ -363,7 +363,7 @@ FullySpecifiedType ApplySubstitution::applySubstitution(int index) const
|
||||
|
||||
} // end of anonymous namespace
|
||||
|
||||
GenTemplateInstance::GenTemplateInstance(const LookupContext &context, const Substitution &substitution)
|
||||
GenTemplateInstance::GenTemplateInstance(const DeprecatedLookupContext &context, const Substitution &substitution)
|
||||
: _symbol(0),
|
||||
_context(context),
|
||||
_substitution(substitution)
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
#include <NameVisitor.h>
|
||||
#include <FullySpecifiedType.h>
|
||||
|
||||
#include "LookupContext.h"
|
||||
#include "DeprecatedLookupContext.h"
|
||||
|
||||
#include <QtCore/QList>
|
||||
#include <QtCore/QPair>
|
||||
@@ -47,7 +47,7 @@ public:
|
||||
typedef QList< QPair<const Identifier *, FullySpecifiedType> > Substitution;
|
||||
|
||||
public:
|
||||
GenTemplateInstance(const LookupContext &context, const Substitution &substitution);
|
||||
GenTemplateInstance(const DeprecatedLookupContext &context, const Substitution &substitution);
|
||||
|
||||
FullySpecifiedType operator()(Symbol *symbol);
|
||||
|
||||
@@ -55,7 +55,7 @@ public:
|
||||
|
||||
private:
|
||||
Symbol *_symbol;
|
||||
LookupContext _context;
|
||||
DeprecatedLookupContext _context;
|
||||
const Substitution _substitution;
|
||||
};
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
**************************************************************************/
|
||||
|
||||
#include "ResolveExpression.h"
|
||||
#include "LookupContext.h"
|
||||
#include "DeprecatedLookupContext.h"
|
||||
#include "Overview.h"
|
||||
#include "GenTemplateInstance.h"
|
||||
|
||||
@@ -71,7 +71,7 @@ static QList<_Tp> removeDuplicates(const QList<_Tp> &results)
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
// ResolveExpression
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
ResolveExpression::ResolveExpression(const LookupContext &context)
|
||||
ResolveExpression::ResolveExpression(const DeprecatedLookupContext &context)
|
||||
: ASTVisitor(context.expressionDocument()->translationUnit()),
|
||||
_context(context),
|
||||
sem(context.expressionDocument()->translationUnit())
|
||||
@@ -845,7 +845,7 @@ ResolveClass::ResolveClass()
|
||||
|
||||
QList<Symbol *> ResolveClass::operator()(const Name *name,
|
||||
const LookupItem &p,
|
||||
const LookupContext &context)
|
||||
const DeprecatedLookupContext &context)
|
||||
{
|
||||
const QList<LookupItem> previousBlackList = _blackList;
|
||||
const QList<Symbol *> symbols = resolveClass(name, p, context);
|
||||
@@ -855,7 +855,7 @@ QList<Symbol *> ResolveClass::operator()(const Name *name,
|
||||
|
||||
QList<Symbol *> ResolveClass::resolveClass(const Name *name,
|
||||
const LookupItem &p,
|
||||
const LookupContext &context)
|
||||
const DeprecatedLookupContext &context)
|
||||
{
|
||||
QList<Symbol *> resolvedSymbols;
|
||||
|
||||
@@ -913,7 +913,7 @@ ResolveObjCClass::ResolveObjCClass()
|
||||
|
||||
QList<Symbol *> ResolveObjCClass::operator ()(const Name *name,
|
||||
const LookupItem &p,
|
||||
const LookupContext &context)
|
||||
const DeprecatedLookupContext &context)
|
||||
{
|
||||
QList<Symbol *> resolvedSymbols;
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
#ifndef CPLUSPLUS_RESOLVEEXPRESSION_H
|
||||
#define CPLUSPLUS_RESOLVEEXPRESSION_H
|
||||
|
||||
#include "LookupContext.h"
|
||||
#include "DeprecatedLookupContext.h"
|
||||
|
||||
#include <ASTVisitor.h>
|
||||
#include <Semantic.h>
|
||||
@@ -41,7 +41,7 @@ namespace CPlusPlus {
|
||||
class CPLUSPLUS_EXPORT ResolveExpression: protected ASTVisitor
|
||||
{
|
||||
public:
|
||||
ResolveExpression(const LookupContext &context);
|
||||
ResolveExpression(const DeprecatedLookupContext &context);
|
||||
virtual ~ResolveExpression();
|
||||
|
||||
QList<LookupItem> operator()(ExpressionAST *ast);
|
||||
@@ -116,7 +116,7 @@ protected:
|
||||
QList<Scope *> visibleScopes(const LookupItem &result) const;
|
||||
|
||||
private:
|
||||
LookupContext _context;
|
||||
DeprecatedLookupContext _context;
|
||||
Semantic sem;
|
||||
QList<LookupItem> _results;
|
||||
Symbol *_declSymbol;
|
||||
@@ -129,12 +129,12 @@ public:
|
||||
|
||||
QList<Symbol *> operator()(const Name *name,
|
||||
const LookupItem &p,
|
||||
const LookupContext &context);
|
||||
const DeprecatedLookupContext &context);
|
||||
|
||||
private:
|
||||
QList<Symbol *> resolveClass(const Name *name,
|
||||
const LookupItem &p,
|
||||
const LookupContext &context);
|
||||
const DeprecatedLookupContext &context);
|
||||
|
||||
private:
|
||||
QList<LookupItem> _blackList;
|
||||
@@ -147,7 +147,7 @@ public:
|
||||
|
||||
QList<Symbol *> operator()(const Name *name,
|
||||
const LookupItem &p,
|
||||
const LookupContext &context);
|
||||
const DeprecatedLookupContext &context);
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
|
||||
#include "TypeOfExpression.h"
|
||||
#include <TranslationUnit.h>
|
||||
#include "LookupContext.h"
|
||||
#include "DeprecatedLookupContext.h"
|
||||
#include "ResolveExpression.h"
|
||||
#include "pp.h"
|
||||
|
||||
@@ -51,7 +51,7 @@ Snapshot TypeOfExpression::snapshot() const
|
||||
void TypeOfExpression::setSnapshot(const Snapshot &documents)
|
||||
{
|
||||
m_snapshot = documents;
|
||||
m_lookupContext = LookupContext();
|
||||
m_lookupContext = DeprecatedLookupContext();
|
||||
}
|
||||
|
||||
QList<LookupItem> TypeOfExpression::operator()(const QString &expression,
|
||||
@@ -66,7 +66,7 @@ QList<LookupItem> TypeOfExpression::operator()(const QString &expression,
|
||||
expressionDoc->check();
|
||||
m_ast = extractExpressionAST(expressionDoc);
|
||||
|
||||
m_lookupContext = LookupContext(lastVisibleSymbol, expressionDoc,
|
||||
m_lookupContext = DeprecatedLookupContext(lastVisibleSymbol, expressionDoc,
|
||||
document, m_snapshot);
|
||||
|
||||
ResolveExpression resolveExpression(m_lookupContext);
|
||||
@@ -84,7 +84,7 @@ ExpressionAST *TypeOfExpression::ast() const
|
||||
return m_ast;
|
||||
}
|
||||
|
||||
const LookupContext &TypeOfExpression::lookupContext() const
|
||||
const DeprecatedLookupContext &TypeOfExpression::lookupContext() const
|
||||
{
|
||||
return m_lookupContext;
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
#define CPLUSPLUS_TYPEOFEXPRESSION_H
|
||||
|
||||
#include "CppDocument.h"
|
||||
#include "LookupContext.h"
|
||||
#include "DeprecatedLookupContext.h"
|
||||
|
||||
#include <ASTfwd.h>
|
||||
#include <QtCore/QMap>
|
||||
@@ -89,7 +89,7 @@ public:
|
||||
/**
|
||||
* Returns the lookup context of the last evaluated expression.
|
||||
*/
|
||||
const LookupContext &lookupContext() const;
|
||||
const DeprecatedLookupContext &lookupContext() const;
|
||||
|
||||
ExpressionAST *expressionAST() const;
|
||||
|
||||
@@ -107,7 +107,7 @@ private:
|
||||
|
||||
Snapshot m_snapshot;
|
||||
ExpressionAST *m_ast;
|
||||
LookupContext m_lookupContext;
|
||||
DeprecatedLookupContext m_lookupContext;
|
||||
};
|
||||
|
||||
} // namespace CPlusPlus
|
||||
|
||||
@@ -34,7 +34,7 @@ HEADERS += \
|
||||
$$PWD/TypeOfExpression.h \
|
||||
$$PWD/TypePrettyPrinter.h \
|
||||
$$PWD/ResolveExpression.h \
|
||||
$$PWD/LookupContext.h \
|
||||
$$PWD/DeprecatedLookupContext.h \
|
||||
$$PWD/CppBindings.h \
|
||||
$$PWD/ASTParent.h \
|
||||
$$PWD/GenTemplateInstance.h \
|
||||
@@ -59,7 +59,7 @@ SOURCES += \
|
||||
$$PWD/TypeOfExpression.cpp \
|
||||
$$PWD/TypePrettyPrinter.cpp \
|
||||
$$PWD/ResolveExpression.cpp \
|
||||
$$PWD/LookupContext.cpp \
|
||||
$$PWD/DeprecatedLookupContext.cpp \
|
||||
$$PWD/CppBindings.cpp \
|
||||
$$PWD/ASTParent.cpp \
|
||||
$$PWD/GenTemplateInstance.cpp \
|
||||
|
||||
@@ -48,7 +48,7 @@
|
||||
#include <TranslationUnit.h>
|
||||
#include <cplusplus/ExpressionUnderCursor.h>
|
||||
#include <cplusplus/TypeOfExpression.h>
|
||||
#include <cplusplus/LookupContext.h>
|
||||
#include <cplusplus/DeprecatedLookupContext.h>
|
||||
#include <cplusplus/Overview.h>
|
||||
#include <cplusplus/OverviewModel.h>
|
||||
#include <cplusplus/SimpleLexer.h>
|
||||
@@ -560,7 +560,7 @@ protected:
|
||||
|
||||
} // end of anonymous namespace
|
||||
|
||||
static const QualifiedNameId *qualifiedNameIdForSymbol(Symbol *s, const LookupContext &context)
|
||||
static const QualifiedNameId *qualifiedNameIdForSymbol(Symbol *s, const DeprecatedLookupContext &context)
|
||||
{
|
||||
const Name *symbolName = s->name();
|
||||
if (! symbolName)
|
||||
@@ -878,7 +878,7 @@ CPlusPlus::Symbol *CPPEditor::findCanonicalSymbol(const QTextCursor &cursor,
|
||||
TypeOfExpression::Preprocess);
|
||||
|
||||
NamespaceBindingPtr glo = bind(doc, snapshot);
|
||||
Symbol *canonicalSymbol = LookupContext::canonicalSymbol(results, glo.data());
|
||||
Symbol *canonicalSymbol = DeprecatedLookupContext::canonicalSymbol(results, glo.data());
|
||||
|
||||
return canonicalSymbol;
|
||||
}
|
||||
@@ -1258,7 +1258,7 @@ void CPPEditor::switchDeclarationDefinition()
|
||||
TypeOfExpression typeOfExpression;
|
||||
typeOfExpression.setSnapshot(m_modelManager->snapshot());
|
||||
QList<LookupItem> resolvedSymbols = typeOfExpression(QString(), doc, lastSymbol);
|
||||
const LookupContext &context = typeOfExpression.lookupContext();
|
||||
const DeprecatedLookupContext &context = typeOfExpression.lookupContext();
|
||||
|
||||
const QualifiedNameId *q = qualifiedNameIdForSymbol(f, context);
|
||||
QList<Symbol *> symbols = context.resolve(q);
|
||||
@@ -1556,7 +1556,7 @@ Symbol *CPPEditor::findDefinition(Symbol *symbol)
|
||||
|
||||
if (score > bestScore) {
|
||||
// create a lookup context
|
||||
const LookupContext context(f, expressionDocument,
|
||||
const DeprecatedLookupContext context(f, expressionDocument,
|
||||
thisDocument, snapshot);
|
||||
|
||||
// search the matching definition for the function declaration `symbol'.
|
||||
|
||||
@@ -180,7 +180,7 @@ static QString buildHelpId(Symbol *symbol, const Name *name)
|
||||
|
||||
// ### move me
|
||||
static FullySpecifiedType resolve(const FullySpecifiedType &ty,
|
||||
const LookupContext &context,
|
||||
const DeprecatedLookupContext &context,
|
||||
Symbol **resolvedSymbol,
|
||||
const Name **resolvedName)
|
||||
{
|
||||
|
||||
@@ -1327,7 +1327,7 @@ const QList<LookupItem> QuickFixOperation::typeOf(CPlusPlus::ExpressionAST *ast)
|
||||
document()->translationUnit()->getTokenStartPosition(ast->firstToken(), &line, &column);
|
||||
Symbol *lastVisibleSymbol = document()->findSymbolAt(line, column);
|
||||
|
||||
_lookupContext = LookupContext(lastVisibleSymbol, document(), document(), snapshot());
|
||||
_lookupContext = DeprecatedLookupContext(lastVisibleSymbol, document(), document(), snapshot());
|
||||
|
||||
ResolveExpression resolveExpression(_lookupContext);
|
||||
return resolveExpression(ast);
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
#include <texteditor/icompletioncollector.h>
|
||||
|
||||
#include <cplusplus/CppDocument.h>
|
||||
#include <cplusplus/LookupContext.h>
|
||||
#include <cplusplus/DeprecatedLookupContext.h>
|
||||
#include <ASTfwd.h>
|
||||
|
||||
#include <utils/changeset.h>
|
||||
@@ -138,7 +138,7 @@ private:
|
||||
Utils::ChangeSet _changeSet;
|
||||
CPPEditor *_editor;
|
||||
CPlusPlus::AST *_topLevelNode;
|
||||
CPlusPlus::LookupContext _lookupContext;
|
||||
CPlusPlus::DeprecatedLookupContext _lookupContext;
|
||||
};
|
||||
|
||||
class CPPQuickFixCollector: public TextEditor::IQuickFixCollector
|
||||
|
||||
@@ -46,7 +46,7 @@
|
||||
#include <TranslationUnit.h>
|
||||
|
||||
#include <cplusplus/ResolveExpression.h>
|
||||
#include <cplusplus/LookupContext.h>
|
||||
#include <cplusplus/DeprecatedLookupContext.h>
|
||||
#include <cplusplus/MatchingText.h>
|
||||
#include <cplusplus/Overview.h>
|
||||
#include <cplusplus/ExpressionUnderCursor.h>
|
||||
@@ -89,7 +89,7 @@ class FunctionArgumentWidget : public QLabel
|
||||
public:
|
||||
FunctionArgumentWidget();
|
||||
void showFunctionHint(QList<Function *> functionSymbols,
|
||||
const LookupContext &context,
|
||||
const DeprecatedLookupContext &context,
|
||||
int startPosition);
|
||||
|
||||
protected:
|
||||
@@ -117,7 +117,7 @@ private:
|
||||
QLabel *m_numberLabel;
|
||||
Utils::FakeToolTip *m_popupFrame;
|
||||
QList<Function *> m_items;
|
||||
LookupContext m_context;
|
||||
DeprecatedLookupContext m_context;
|
||||
};
|
||||
|
||||
class ConvertToCompletionItem: protected NameVisitor
|
||||
@@ -265,7 +265,7 @@ FunctionArgumentWidget::FunctionArgumentWidget():
|
||||
}
|
||||
|
||||
void FunctionArgumentWidget::showFunctionHint(QList<Function *> functionSymbols,
|
||||
const LookupContext &context,
|
||||
const DeprecatedLookupContext &context,
|
||||
int startPosition)
|
||||
{
|
||||
Q_ASSERT(!functionSymbols.isEmpty());
|
||||
@@ -798,7 +798,7 @@ int CppCodeCompletion::startCompletionInternal(TextEditor::BaseTextEditor *edit,
|
||||
|
||||
|
||||
QList<LookupItem> results = typeOfExpression(expression, thisDocument, lastVisibleSymbol, TypeOfExpression::Preprocess);
|
||||
LookupContext context = typeOfExpression.lookupContext();
|
||||
DeprecatedLookupContext context = typeOfExpression.lookupContext();
|
||||
|
||||
if (results.isEmpty()) {
|
||||
if (m_completionOperator == T_SIGNAL || m_completionOperator == T_SLOT) {
|
||||
@@ -894,7 +894,7 @@ int CppCodeCompletion::globalCompletion(Symbol *lastVisibleSymbol,
|
||||
}
|
||||
|
||||
Document::Ptr exprDoc = Document::create(QLatin1String("<expression>"));
|
||||
const LookupContext context(lastVisibleSymbol, exprDoc, thisDocument, snapshot);
|
||||
const DeprecatedLookupContext context(lastVisibleSymbol, exprDoc, thisDocument, snapshot);
|
||||
const QList<Scope *> scopes = context.expand(context.visibleScopes());
|
||||
|
||||
foreach (Scope *scope, scopes) {
|
||||
@@ -907,7 +907,7 @@ int CppCodeCompletion::globalCompletion(Symbol *lastVisibleSymbol,
|
||||
}
|
||||
|
||||
bool CppCodeCompletion::completeConstructorOrFunction(const QList<LookupItem> &results,
|
||||
const LookupContext &context,
|
||||
const DeprecatedLookupContext &context,
|
||||
int endOfExpression, bool toolTipOnly)
|
||||
{
|
||||
QList<Function *> functions;
|
||||
@@ -1101,7 +1101,7 @@ bool CppCodeCompletion::completeConstructorOrFunction(const QList<LookupItem> &r
|
||||
}
|
||||
|
||||
bool CppCodeCompletion::completeMember(const QList<LookupItem> &baseResults,
|
||||
const LookupContext &context)
|
||||
const DeprecatedLookupContext &context)
|
||||
{
|
||||
if (baseResults.isEmpty())
|
||||
return false;
|
||||
@@ -1149,7 +1149,7 @@ bool CppCodeCompletion::completeMember(const QList<LookupItem> &baseResults,
|
||||
}
|
||||
|
||||
bool CppCodeCompletion::completeScope(const QList<LookupItem> &results,
|
||||
const LookupContext &context)
|
||||
const DeprecatedLookupContext &context)
|
||||
{
|
||||
QList<Symbol *> classes, namespaces;
|
||||
|
||||
@@ -1296,7 +1296,7 @@ bool CppCodeCompletion::completeInclude(const QTextCursor &cursor)
|
||||
}
|
||||
|
||||
void CppCodeCompletion::completeNamespace(const QList<Symbol *> &candidates,
|
||||
const LookupContext &context)
|
||||
const DeprecatedLookupContext &context)
|
||||
{
|
||||
QList<Scope *> todo;
|
||||
QList<Scope *> visibleScopes = context.visibleScopes();
|
||||
@@ -1318,7 +1318,7 @@ void CppCodeCompletion::completeNamespace(const QList<Symbol *> &candidates,
|
||||
}
|
||||
|
||||
void CppCodeCompletion::completeClass(const QList<Symbol *> &candidates,
|
||||
const LookupContext &context,
|
||||
const DeprecatedLookupContext &context,
|
||||
bool staticLookup)
|
||||
{
|
||||
if (candidates.isEmpty())
|
||||
@@ -1351,7 +1351,7 @@ void CppCodeCompletion::completeClass(const QList<Symbol *> &candidates,
|
||||
}
|
||||
|
||||
bool CppCodeCompletion::completeQtMethod(const QList<LookupItem> &results,
|
||||
const LookupContext &context,
|
||||
const DeprecatedLookupContext &context,
|
||||
bool wantSignals)
|
||||
{
|
||||
if (results.isEmpty())
|
||||
|
||||
@@ -107,34 +107,34 @@ private:
|
||||
const CPlusPlus::Snapshot &snapshot);
|
||||
|
||||
bool completeConstructorOrFunction(const QList<CPlusPlus::LookupItem> &,
|
||||
const CPlusPlus::LookupContext &,
|
||||
const CPlusPlus::DeprecatedLookupContext &,
|
||||
int endOfExpression, bool toolTipOnly);
|
||||
|
||||
bool completeMember(const QList<CPlusPlus::LookupItem> &,
|
||||
const CPlusPlus::LookupContext &context);
|
||||
const CPlusPlus::DeprecatedLookupContext &context);
|
||||
|
||||
bool completeScope(const QList<CPlusPlus::LookupItem> &,
|
||||
const CPlusPlus::LookupContext &context);
|
||||
const CPlusPlus::DeprecatedLookupContext &context);
|
||||
|
||||
void completeNamespace(const QList<CPlusPlus::Symbol *> &candidates,
|
||||
const CPlusPlus::LookupContext &context);
|
||||
const CPlusPlus::DeprecatedLookupContext &context);
|
||||
|
||||
void completeClass(const QList<CPlusPlus::Symbol *> &candidates,
|
||||
const CPlusPlus::LookupContext &context,
|
||||
const CPlusPlus::DeprecatedLookupContext &context,
|
||||
bool staticLookup = true);
|
||||
|
||||
bool completeConstructors(CPlusPlus::Class *klass);
|
||||
|
||||
bool completeQtMethod(const QList<CPlusPlus::LookupItem> &,
|
||||
const CPlusPlus::LookupContext &context,
|
||||
const CPlusPlus::DeprecatedLookupContext &context,
|
||||
bool wantSignals);
|
||||
|
||||
bool completeSignal(const QList<CPlusPlus::LookupItem> &results,
|
||||
const CPlusPlus::LookupContext &context)
|
||||
const CPlusPlus::DeprecatedLookupContext &context)
|
||||
{ return completeQtMethod(results, context, true); }
|
||||
|
||||
bool completeSlot(const QList<CPlusPlus::LookupItem> &results,
|
||||
const CPlusPlus::LookupContext &context)
|
||||
const CPlusPlus::DeprecatedLookupContext &context)
|
||||
{ return completeQtMethod(results, context, false); }
|
||||
|
||||
int findStartOfName(int pos = -1) const;
|
||||
|
||||
@@ -77,7 +77,7 @@
|
||||
#include <Parser.h>
|
||||
#include <Control.h>
|
||||
|
||||
#include <cplusplus/LookupContext.h>
|
||||
#include <cplusplus/DeprecatedLookupContext.h>
|
||||
|
||||
#include <QtCore/QCoreApplication>
|
||||
#include <QtCore/QDebug>
|
||||
@@ -282,12 +282,12 @@ public:
|
||||
_workingCopy(workingCopy)
|
||||
{ }
|
||||
|
||||
LookupContext lookupContext(unsigned line, unsigned column) const
|
||||
DeprecatedLookupContext lookupContext(unsigned line, unsigned column) const
|
||||
{ return lookupContext(_doc->findSymbolAt(line, column)); }
|
||||
|
||||
LookupContext lookupContext(Symbol *symbol) const
|
||||
DeprecatedLookupContext lookupContext(Symbol *symbol) const
|
||||
{
|
||||
LookupContext context(symbol, Document::create(QLatin1String("<none>")), _doc, _snapshot);
|
||||
DeprecatedLookupContext context(symbol, Document::create(QLatin1String("<none>")), _doc, _snapshot);
|
||||
return context;
|
||||
}
|
||||
|
||||
@@ -825,7 +825,7 @@ QList<int> CppModelManager::references(CPlusPlus::Symbol *symbol,
|
||||
const CPlusPlus::Snapshot &snapshot)
|
||||
{
|
||||
NamespaceBindingPtr glo = bind(doc, snapshot);
|
||||
return m_findReferences->references(LookupContext::canonicalSymbol(symbol, glo.data()), doc, snapshot);
|
||||
return m_findReferences->references(DeprecatedLookupContext::canonicalSymbol(symbol, glo.data()), doc, snapshot);
|
||||
}
|
||||
|
||||
void CppModelManager::findUsages(CPlusPlus::Document::Ptr symbolDocument, CPlusPlus::Symbol *symbol)
|
||||
|
||||
@@ -44,7 +44,7 @@
|
||||
#include <cplusplus/Literals.h>
|
||||
#include <cplusplus/Scope.h>
|
||||
#include <cplusplus/Control.h>
|
||||
#include <cplusplus/LookupContext.h>
|
||||
#include <cplusplus/DeprecatedLookupContext.h>
|
||||
#include <coreplugin/icore.h>
|
||||
#include <coreplugin/editormanager/editormanager.h>
|
||||
#include <extensionsystem/pluginmanager.h>
|
||||
@@ -317,7 +317,7 @@ static Document::Ptr findDefinition(const Function *functionDeclaration, int *li
|
||||
|
||||
Control control;
|
||||
const QualifiedNameId *q = control.qualifiedNameId(&qualifiedName[0], qualifiedName.size());
|
||||
LookupContext context(&control);
|
||||
DeprecatedLookupContext context(&control);
|
||||
const Snapshot documents = cppModelManager->snapshot();
|
||||
foreach (Document::Ptr doc, documents) {
|
||||
QList<Scope *> visibleScopes;
|
||||
|
||||
Reference in New Issue
Block a user