forked from qt-creator/qt-creator
Renamed Symbol::scope() to Symbol::enclosingScope().
This commit is contained in:
@@ -748,7 +748,7 @@ Symbol *Snapshot::findMatchingDefinition(Symbol *declaration) const
|
||||
continue; // nothing to do
|
||||
|
||||
foreach (Function *fun, result) {
|
||||
const QList<LookupItem> declarations = context.lookup(fun->name(), fun->scope());
|
||||
const QList<LookupItem> declarations = context.lookup(fun->name(), fun->enclosingScope());
|
||||
if (declarations.isEmpty())
|
||||
continue;
|
||||
|
||||
|
||||
@@ -129,7 +129,7 @@ private:
|
||||
virtual void visit(Function *funTy)
|
||||
{
|
||||
Function *fun = control()->newFunction(/*sourceLocation=*/ 0, funTy->name());
|
||||
fun->setScope(funTy->scope());
|
||||
fun->setScope(funTy->enclosingScope());
|
||||
fun->setConst(funTy->isConst());
|
||||
fun->setVolatile(funTy->isVolatile());
|
||||
fun->setVirtual(funTy->isVirtual());
|
||||
|
||||
@@ -224,8 +224,8 @@ bool FindUsages::checkCandidates(const QList<LookupItem> &candidates) const
|
||||
return false;
|
||||
}
|
||||
|
||||
if (isLocalScope(_declSymbol->scope()) || isLocalScope(s->scope())) {
|
||||
if (s->scope() != _declSymbol->scope())
|
||||
if (isLocalScope(_declSymbol->enclosingScope()) || isLocalScope(s->enclosingScope())) {
|
||||
if (s->enclosingScope() != _declSymbol->enclosingScope())
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -104,7 +104,7 @@ Icons::IconType Icons::iconTypeForSymbol(const Symbol *symbol)
|
||||
} else if (symbol->isPrivate()) {
|
||||
return FuncPrivateIconType;
|
||||
}
|
||||
} else if (symbol->scope() && symbol->scope()->isEnum()) {
|
||||
} else if (symbol->enclosingScope() && symbol->enclosingScope()->isEnum()) {
|
||||
return EnumeratorIconType;
|
||||
} else if (symbol->isDeclaration() || symbol->isArgument()) {
|
||||
if (symbol->isPublic()) {
|
||||
|
||||
@@ -68,7 +68,7 @@ static void path_helper(Symbol *symbol, QList<const Name *> *names)
|
||||
if (! symbol)
|
||||
return;
|
||||
|
||||
path_helper(symbol->scope(), names);
|
||||
path_helper(symbol->enclosingScope(), names);
|
||||
|
||||
if (symbol->name()) {
|
||||
if (symbol->isClass() || symbol->isNamespace()) {
|
||||
@@ -142,7 +142,7 @@ LookupContext &LookupContext::operator = (const LookupContext &other)
|
||||
|
||||
QList<const Name *> LookupContext::fullyQualifiedName(Symbol *symbol)
|
||||
{
|
||||
QList<const Name *> qualifiedName = path(symbol->scope());
|
||||
QList<const Name *> qualifiedName = path(symbol->enclosingScope());
|
||||
addNames(symbol->name(), &qualifiedName, /*add all names*/ true);
|
||||
return qualifiedName;
|
||||
}
|
||||
@@ -256,7 +256,7 @@ QList<LookupItem> LookupContext::lookup(const Name *name, Scope *scope) const
|
||||
if (! name)
|
||||
return candidates;
|
||||
|
||||
for (; scope; scope = scope->scope()) {
|
||||
for (; scope; scope = scope->enclosingScope()) {
|
||||
if ((name->isNameId() || name->isTemplateNameId()) && scope->isBlock()) {
|
||||
bindings()->lookupInScope(name, scope, &candidates, /*templateId = */ 0, /*binding=*/ 0);
|
||||
|
||||
|
||||
@@ -67,7 +67,7 @@ void LookupItem::setDeclaration(Symbol *declaration)
|
||||
Scope *LookupItem::scope() const
|
||||
{
|
||||
if (! _scope && _declaration)
|
||||
return _declaration->scope();
|
||||
return _declaration->enclosingScope();
|
||||
|
||||
return _scope;
|
||||
}
|
||||
|
||||
@@ -90,10 +90,10 @@ QModelIndex OverviewModel::parent(const QModelIndex &child) const
|
||||
if (!symbol) // account for no symbol item
|
||||
return QModelIndex();
|
||||
|
||||
if (Scope *scope = symbol->scope()) {
|
||||
if (scope->scope()) {
|
||||
if (Scope *scope = symbol->enclosingScope()) {
|
||||
if (scope->enclosingScope()) {
|
||||
QModelIndex index;
|
||||
if (scope->scope() && scope->scope()->scope()) // the parent doesn't have a parent
|
||||
if (scope->enclosingScope() && scope->enclosingScope()->enclosingScope()) // the parent doesn't have a parent
|
||||
index = createIndex(scope->index(), 0, scope);
|
||||
else //+1 to account for no symbol item
|
||||
index = createIndex(scope->index() + 1, 0, scope);
|
||||
|
||||
@@ -115,7 +115,7 @@ void ResolveExpression::addResults(const QList<Symbol *> &symbols)
|
||||
foreach (Symbol *symbol, symbols) {
|
||||
LookupItem item;
|
||||
item.setType(symbol->type());
|
||||
item.setScope(symbol->scope());
|
||||
item.setScope(symbol->enclosingScope());
|
||||
item.setDeclaration(symbol);
|
||||
_results.append(item);
|
||||
}
|
||||
@@ -313,18 +313,18 @@ bool ResolveExpression::visit(ThisExpressionAST *)
|
||||
void ResolveExpression::thisObject()
|
||||
{
|
||||
Scope *scope = _scope;
|
||||
for (; scope; scope = scope->scope()) {
|
||||
for (; scope; scope = scope->enclosingScope()) {
|
||||
if (Function *fun = scope->asFunction()) {
|
||||
if (Class *klass = scope->enclosingClass()) {
|
||||
FullySpecifiedType classTy(control()->namedType(klass->name()));
|
||||
FullySpecifiedType ptrTy(control()->pointerType(classTy));
|
||||
addResult(ptrTy, fun->scope());
|
||||
addResult(ptrTy, fun->enclosingScope());
|
||||
break;
|
||||
} else if (const QualifiedNameId *q = fun->name()->asQualifiedNameId()) {
|
||||
if (q->base()) {
|
||||
FullySpecifiedType classTy(control()->namedType(q->base()));
|
||||
FullySpecifiedType ptrTy(control()->pointerType(classTy));
|
||||
addResult(ptrTy, fun->scope());
|
||||
addResult(ptrTy, fun->enclosingScope());
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -666,10 +666,10 @@ ClassOrNamespace *ResolveExpression::baseExpression(const QList<LookupItem> &bas
|
||||
FullySpecifiedType retTy = instantiatedFunction->returnType().simplified();
|
||||
|
||||
if (PointerType *ptrTy = retTy->asPointerType()) {
|
||||
if (ClassOrNamespace *retBinding = findClass(ptrTy->elementType(), overload->scope()))
|
||||
if (ClassOrNamespace *retBinding = findClass(ptrTy->elementType(), overload->enclosingScope()))
|
||||
return retBinding;
|
||||
|
||||
else if (scope != overload->scope()) {
|
||||
else if (scope != overload->enclosingScope()) {
|
||||
if (ClassOrNamespace *retBinding = findClass(ptrTy->elementType(), scope))
|
||||
return retBinding;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user