summaryrefslogtreecommitdiff
path: root/src/libs/cplusplus/LookupContext.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/libs/cplusplus/LookupContext.cpp')
-rw-r--r--src/libs/cplusplus/LookupContext.cpp55
1 files changed, 21 insertions, 34 deletions
diff --git a/src/libs/cplusplus/LookupContext.cpp b/src/libs/cplusplus/LookupContext.cpp
index 897d532e2a..6b718cfbc3 100644
--- a/src/libs/cplusplus/LookupContext.cpp
+++ b/src/libs/cplusplus/LookupContext.cpp
@@ -152,47 +152,42 @@ uint qHash(const FullyQualifiedName &fullyQualifiedName)
// LookupContext
/////////////////////////////////////////////////////////////////////
LookupContext::LookupContext()
- : _control(new Control())
- , m_expandTemplates(false)
+ : m_expandTemplates(false)
{ }
LookupContext::LookupContext(Document::Ptr thisDocument,
const Snapshot &snapshot)
- : _expressionDocument(Document::create(QLatin1String("<LookupContext>"))),
- _thisDocument(thisDocument),
- _snapshot(snapshot),
- _control(new Control()),
- m_expandTemplates(false)
+ : _expressionDocument(Document::create(QLatin1String("<LookupContext>")))
+ , _thisDocument(thisDocument)
+ , _snapshot(snapshot)
+ , m_expandTemplates(false)
{
}
LookupContext::LookupContext(Document::Ptr expressionDocument,
Document::Ptr thisDocument,
const Snapshot &snapshot)
- : _expressionDocument(expressionDocument),
- _thisDocument(thisDocument),
- _snapshot(snapshot),
- _control(new Control()),
- m_expandTemplates(false)
+ : _expressionDocument(expressionDocument)
+ , _thisDocument(thisDocument)
+ , _snapshot(snapshot)
+ , m_expandTemplates(false)
{
}
LookupContext::LookupContext(const LookupContext &other)
- : _expressionDocument(other._expressionDocument),
- _thisDocument(other._thisDocument),
- _snapshot(other._snapshot),
- _bindings(other._bindings),
- _control(other._control),
- m_expandTemplates(other.m_expandTemplates)
+ : _expressionDocument(other._expressionDocument)
+ , _thisDocument(other._thisDocument)
+ , _snapshot(other._snapshot)
+ , _bindings(other._bindings)
+ , m_expandTemplates(other.m_expandTemplates)
{ }
-LookupContext &LookupContext::operator = (const LookupContext &other)
+LookupContext &LookupContext::operator=(const LookupContext &other)
{
_expressionDocument = other._expressionDocument;
_thisDocument = other._thisDocument;
_snapshot = other._snapshot;
_bindings = other._bindings;
- _control = other._control;
m_expandTemplates = other.m_expandTemplates;
return *this;
}
@@ -278,7 +273,7 @@ QList<LookupItem> LookupContext::lookupByUsing(const Name *name, Scope *scope) c
QSharedPointer<CreateBindings> LookupContext::bindings() const
{
if (! _bindings) {
- _bindings = QSharedPointer<CreateBindings>(new CreateBindings(_thisDocument, _snapshot, control()));
+ _bindings = QSharedPointer<CreateBindings>(new CreateBindings(_thisDocument, _snapshot));
_bindings->setExpandTemplates(m_expandTemplates);
}
@@ -290,11 +285,6 @@ void LookupContext::setBindings(QSharedPointer<CreateBindings> bindings)
_bindings = bindings;
}
-QSharedPointer<Control> LookupContext::control() const
-{
- return _control;
-}
-
Document::Ptr LookupContext::expressionDocument() const
{ return _expressionDocument; }
@@ -694,7 +684,7 @@ void CreateBindings::lookupInScope(const Name *name, Scope *scope,
}
if (templateId && (s->isDeclaration() || s->isFunction())) {
- FullySpecifiedType ty = DeprecatedGenTemplateInstance::instantiate(templateId, s, _control);
+ FullySpecifiedType ty = DeprecatedGenTemplateInstance::instantiate(templateId, s, control());
item.setType(ty); // override the type.
}
@@ -1278,8 +1268,10 @@ ClassOrNamespace *ClassOrNamespace::findOrCreateType(const Name *name, ClassOrNa
return 0;
}
-CreateBindings::CreateBindings(Document::Ptr thisDocument, const Snapshot &snapshot, QSharedPointer<Control> control)
- : _snapshot(snapshot), _control(control), _expandTemplates(false)
+CreateBindings::CreateBindings(Document::Ptr thisDocument, const Snapshot &snapshot)
+ : _snapshot(snapshot)
+ , _control(QSharedPointer<Control>(new Control))
+ , _expandTemplates(false)
{
_globalNamespace = allocClassOrNamespace(/*parent = */ 0);
_currentClassOrNamespace = _globalNamespace;
@@ -1340,11 +1332,6 @@ void CreateBindings::process(Symbol *symbol)
_currentClassOrNamespace->addTodo(symbol);
}
-QSharedPointer<Control> CreateBindings::control() const
-{
- return _control;
-}
-
ClassOrNamespace *CreateBindings::allocClassOrNamespace(ClassOrNamespace *parent)
{
ClassOrNamespace *e = new ClassOrNamespace(this, parent);