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;
|
||||
}
|
||||
|
||||
@@ -205,7 +205,7 @@ protected:
|
||||
|
||||
if (symbol->isTypedef())
|
||||
addType(symbol->name());
|
||||
else if (! symbol->type()->isFunctionType() && symbol->scope()->isClass())
|
||||
else if (! symbol->type()->isFunctionType() && symbol->enclosingScope()->isClass())
|
||||
addMember(symbol->name());
|
||||
|
||||
return true;
|
||||
@@ -465,7 +465,7 @@ bool CheckSymbols::visit(SimpleDeclarationAST *ast)
|
||||
if (funTy->isVirtual()) {
|
||||
addUse(declId, Use::VirtualMethod);
|
||||
} else if (maybeVirtualMethod(decl->name())) {
|
||||
addVirtualMethod(_context.lookup(decl->name(), decl->scope()), declId, funTy->argumentCount());
|
||||
addVirtualMethod(_context.lookup(decl->name(), decl->enclosingScope()), declId, funTy->argumentCount());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -768,7 +768,7 @@ bool CheckSymbols::visit(FunctionDefinitionAST *ast)
|
||||
if (fun->isVirtual()) {
|
||||
addUse(declId, Use::VirtualMethod);
|
||||
} else if (maybeVirtualMethod(fun->name())) {
|
||||
addVirtualMethod(_context.lookup(fun->name(), fun->scope()), declId, fun->argumentCount());
|
||||
addVirtualMethod(_context.lookup(fun->name(), fun->enclosingScope()), declId, fun->argumentCount());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -932,7 +932,7 @@ void CheckSymbols::addClassMember(const QList<LookupItem> &candidates, NameAST *
|
||||
continue;
|
||||
else if (! c->isDeclaration())
|
||||
return;
|
||||
else if (! (c->scope() && c->scope()->isClass()))
|
||||
else if (! (c->enclosingScope() && c->enclosingScope()->isClass()))
|
||||
return; // shadowed
|
||||
else if (c->isTypedef() || c->type()->isFunctionType())
|
||||
return; // shadowed
|
||||
@@ -961,7 +961,7 @@ void CheckSymbols::addStatic(const QList<LookupItem> &candidates, NameAST *ast)
|
||||
Symbol *c = r.declaration();
|
||||
if (! c)
|
||||
return;
|
||||
if (c->scope()->isEnum()) {
|
||||
if (c->enclosingScope()->isEnum()) {
|
||||
unsigned line, column;
|
||||
getTokenStartPosition(startToken, &line, &column);
|
||||
const unsigned length = tok.length();
|
||||
|
||||
@@ -346,10 +346,10 @@ struct CanonicalSymbol
|
||||
const LookupItem &r = results.at(i);
|
||||
Symbol *decl = r.declaration();
|
||||
|
||||
if (! (decl && decl->scope()))
|
||||
if (! (decl && decl->enclosingScope()))
|
||||
break;
|
||||
|
||||
if (Class *classScope = r.declaration()->scope()->asClass()) {
|
||||
if (Class *classScope = r.declaration()->enclosingScope()->asClass()) {
|
||||
const Identifier *declId = decl->identifier();
|
||||
const Identifier *classId = classScope->identifier();
|
||||
|
||||
@@ -1092,7 +1092,7 @@ void CPPEditor::switchDeclarationDefinition()
|
||||
LookupContext context(thisDocument, snapshot);
|
||||
|
||||
Function *functionDefinition = functionScope->asFunction();
|
||||
const QList<LookupItem> declarations = context.lookup(functionDefinition->name(), functionDefinition->scope());
|
||||
const QList<LookupItem> declarations = context.lookup(functionDefinition->name(), functionDefinition->enclosingScope());
|
||||
foreach (const LookupItem &r, declarations) {
|
||||
Symbol *decl = r.declaration();
|
||||
// TODO: check decl.
|
||||
|
||||
@@ -183,7 +183,7 @@ void CppElementEvaluator::handleLookupItemMatch(const Snapshot &snapshot,
|
||||
if (m_lookupBaseClasses)
|
||||
cppClass->lookupBases(declaration, context);
|
||||
m_element = QSharedPointer<CppElement>(cppClass);
|
||||
} else if (declaration->isEnum() || declaration->scope()->isEnum()) {
|
||||
} else if (declaration->isEnum() || declaration->enclosingScope()->isEnum()) {
|
||||
m_element = QSharedPointer<CppElement>(new CppEnum(declaration));
|
||||
} else if (declaration->isTypedef()) {
|
||||
m_element = QSharedPointer<CppElement>(new CppTypedef(declaration));
|
||||
@@ -310,9 +310,9 @@ CppDeclarableElement::CppDeclarableElement(Symbol *declaration) : CppElement()
|
||||
|
||||
m_icon = Icons().iconForSymbol(declaration);
|
||||
m_name = overview.prettyName(declaration->name());
|
||||
if (declaration->scope()->isClass() ||
|
||||
declaration->scope()->isNamespace() ||
|
||||
declaration->scope()->isEnum()) {
|
||||
if (declaration->enclosingScope()->isClass() ||
|
||||
declaration->enclosingScope()->isNamespace() ||
|
||||
declaration->enclosingScope()->isEnum()) {
|
||||
m_qualifiedName = overview.prettyName(LookupContext::fullyQualifiedName(declaration));
|
||||
} else {
|
||||
m_qualifiedName = m_name;
|
||||
@@ -440,8 +440,8 @@ CppEnum::CppEnum(Symbol *declaration) : CppDeclarableElement(declaration)
|
||||
{
|
||||
setHelpCategory(CppHoverHandler::HelpCandidate::Enum);
|
||||
|
||||
if (declaration->scope()->isEnum()) {
|
||||
Symbol *enumSymbol = declaration->scope()->asEnum();
|
||||
if (declaration->enclosingScope()->isEnum()) {
|
||||
Symbol *enumSymbol = declaration->enclosingScope()->asEnum();
|
||||
Overview overview;
|
||||
setHelpMark(overview.prettyName(enumSymbol->name()));
|
||||
setTooltip(overview.prettyName(LookupContext::fullyQualifiedName(enumSymbol)));
|
||||
|
||||
@@ -111,7 +111,7 @@ protected:
|
||||
if (Symbol *member = _scopeStack.at(i)->find(id)) {
|
||||
if (member->isTypedef())
|
||||
continue;
|
||||
else if (!member->isGenerated() && (member->sourceLocation() < ast->firstToken() || member->scope()->isFunction())) {
|
||||
else if (!member->isGenerated() && (member->sourceLocation() < ast->firstToken() || member->enclosingScope()->isFunction())) {
|
||||
unsigned line, column;
|
||||
getTokenStartPosition(simpleName->identifier_token, &line, &column);
|
||||
localUses[member].append(SemanticInfo::Use(line, column, id->size(), SemanticInfo::Use::Local));
|
||||
|
||||
@@ -67,7 +67,7 @@ QString AbstractEditorSupport::functionAt(const CppModelManagerInterface *modelM
|
||||
if (!document)
|
||||
return QString();
|
||||
if (const CPlusPlus::Symbol *symbol = document->lastVisibleSymbolAt(line, column))
|
||||
if (const CPlusPlus::Scope *scope = symbol->scope())
|
||||
if (const CPlusPlus::Scope *scope = symbol->enclosingScope())
|
||||
if (const CPlusPlus::Scope *functionScope = scope->enclosingFunction())
|
||||
if (const CPlusPlus::Symbol *function = functionScope) {
|
||||
const CPlusPlus::Overview o;
|
||||
|
||||
@@ -1055,7 +1055,7 @@ void CppCodeCompletion::globalCompletion(Scope *currentScope)
|
||||
QList<ClassOrNamespace *> usingBindings;
|
||||
ClassOrNamespace *currentBinding = 0;
|
||||
|
||||
for (Scope *scope = currentScope; scope; scope = scope->scope()) {
|
||||
for (Scope *scope = currentScope; scope; scope = scope->enclosingScope()) {
|
||||
if (scope->isBlock()) {
|
||||
if (ClassOrNamespace *binding = context.lookupType(scope)) {
|
||||
for (unsigned i = 0; i < scope->memberCount(); ++i) {
|
||||
@@ -1074,7 +1074,7 @@ void CppCodeCompletion::globalCompletion(Scope *currentScope)
|
||||
}
|
||||
}
|
||||
|
||||
for (Scope *scope = currentScope; scope; scope = scope->scope()) {
|
||||
for (Scope *scope = currentScope; scope; scope = scope->enclosingScope()) {
|
||||
if (scope->isBlock()) {
|
||||
for (unsigned i = 0; i < scope->memberCount(); ++i) {
|
||||
addCompletionItem(scope->memberAt(i));
|
||||
@@ -1153,7 +1153,7 @@ bool CppCodeCompletion::completeConstructorOrFunction(const QList<LookupItem> &r
|
||||
|
||||
if (! fun->name())
|
||||
continue;
|
||||
else if (! functions.isEmpty() && functions.first()->scope() != fun->scope())
|
||||
else if (! functions.isEmpty() && functions.first()->enclosingScope() != fun->enclosingScope())
|
||||
continue; // skip fun, it's an hidden declaration.
|
||||
|
||||
bool newOverload = true;
|
||||
|
||||
@@ -190,8 +190,8 @@ static void find_helper(QFutureInterface<Usage> &future,
|
||||
const QString sourceFile = QString::fromUtf8(symbol->fileName(), symbol->fileNameLength());
|
||||
QStringList files(sourceFile);
|
||||
|
||||
if (symbol->isClass() || symbol->isForwardClassDeclaration() || (symbol->scope() && ! symbol->isStatic() &&
|
||||
symbol->scope()->isNamespace())) {
|
||||
if (symbol->isClass() || symbol->isForwardClassDeclaration() || (symbol->enclosingScope() && ! symbol->isStatic() &&
|
||||
symbol->enclosingScope()->isNamespace())) {
|
||||
foreach (const Document::Ptr &doc, context.snapshot()) {
|
||||
if (doc->fileName() == sourceFile)
|
||||
continue;
|
||||
|
||||
@@ -143,7 +143,7 @@ void SymbolTable::enterSymbol(Symbol *symbol)
|
||||
_symbols = reinterpret_cast<Symbol **>(realloc(_symbols, sizeof(Symbol *) * _allocatedSymbols));
|
||||
}
|
||||
|
||||
assert(! symbol->_scope || symbol->scope() == _owner);
|
||||
assert(! symbol->_scope || symbol->enclosingScope() == _owner);
|
||||
symbol->_index = _symbolCount;
|
||||
symbol->_scope = _owner;
|
||||
_symbols[_symbolCount] = symbol;
|
||||
|
||||
@@ -233,7 +233,7 @@ const Identifier *Symbol::identifier() const
|
||||
return 0;
|
||||
}
|
||||
|
||||
Scope *Symbol::scope() const
|
||||
Scope *Symbol::enclosingScope() const
|
||||
{ return _scope; }
|
||||
|
||||
void Symbol::setScope(Scope *scope)
|
||||
@@ -244,7 +244,7 @@ void Symbol::setScope(Scope *scope)
|
||||
|
||||
Namespace *Symbol::enclosingNamespace() const
|
||||
{
|
||||
for (Scope *s = _scope; s; s = s->scope()) {
|
||||
for (Scope *s = _scope; s; s = s->enclosingScope()) {
|
||||
if (Namespace *ns = s->asNamespace())
|
||||
return ns;
|
||||
}
|
||||
@@ -253,7 +253,7 @@ Namespace *Symbol::enclosingNamespace() const
|
||||
|
||||
Template *Symbol::enclosingTemplate() const
|
||||
{
|
||||
for (Scope *s = _scope; s; s = s->scope()) {
|
||||
for (Scope *s = _scope; s; s = s->enclosingScope()) {
|
||||
if (Template *templ = s->asTemplate())
|
||||
return templ;
|
||||
}
|
||||
@@ -262,7 +262,7 @@ Template *Symbol::enclosingTemplate() const
|
||||
|
||||
Class *Symbol::enclosingClass() const
|
||||
{
|
||||
for (Scope *s = _scope; s; s = s->scope()) {
|
||||
for (Scope *s = _scope; s; s = s->enclosingScope()) {
|
||||
if (Class *klass = s->asClass())
|
||||
return klass;
|
||||
}
|
||||
@@ -271,7 +271,7 @@ Class *Symbol::enclosingClass() const
|
||||
|
||||
Enum *Symbol::enclosingEnum() const
|
||||
{
|
||||
for (Scope *s = _scope; s; s = s->scope()) {
|
||||
for (Scope *s = _scope; s; s = s->enclosingScope()) {
|
||||
if (Enum *e = s->asEnum())
|
||||
return e;
|
||||
}
|
||||
@@ -280,7 +280,7 @@ Enum *Symbol::enclosingEnum() const
|
||||
|
||||
Function *Symbol::enclosingFunction() const
|
||||
{
|
||||
for (Scope *s = _scope; s; s = s->scope()) {
|
||||
for (Scope *s = _scope; s; s = s->enclosingScope()) {
|
||||
if (Function *fun = s->asFunction())
|
||||
return fun;
|
||||
}
|
||||
@@ -289,7 +289,7 @@ Function *Symbol::enclosingFunction() const
|
||||
|
||||
Block *Symbol::enclosingBlock() const
|
||||
{
|
||||
for (Scope *s = _scope; s; s = s->scope()) {
|
||||
for (Scope *s = _scope; s; s = s->enclosingScope()) {
|
||||
if (Block *block = s->asBlock())
|
||||
return block;
|
||||
}
|
||||
|
||||
@@ -287,7 +287,7 @@ public:
|
||||
void setUnavailable(bool isUnavailable);
|
||||
|
||||
/// Returns this Symbol's eclosing scope.
|
||||
Scope *scope() const;
|
||||
Scope *enclosingScope() const;
|
||||
|
||||
/// Returns the eclosing namespace scope.
|
||||
Namespace *enclosingNamespace() const;
|
||||
@@ -307,7 +307,7 @@ public:
|
||||
/// Returns the enclosing Block scope.
|
||||
Block *enclosingBlock() const;
|
||||
|
||||
void setScope(Scope *scope); // ### make me private
|
||||
void setScope(Scope *enclosingScope); // ### make me private
|
||||
void setSourceLocation(unsigned sourceLocation, TranslationUnit *translationUnit); // ### make me private
|
||||
|
||||
void visitSymbol(SymbolVisitor *visitor);
|
||||
|
||||
@@ -100,7 +100,7 @@ void tst_Lookup::base_class_defined_1()
|
||||
|
||||
const LookupContext ctx(doc, snapshot);
|
||||
|
||||
ClassOrNamespace *klass = ctx.lookupType(derivedClass->baseClassAt(0)->name(), derivedClass->scope());
|
||||
ClassOrNamespace *klass = ctx.lookupType(derivedClass->baseClassAt(0)->name(), derivedClass->enclosingScope());
|
||||
QVERIFY(klass != 0);
|
||||
|
||||
QCOMPARE(klass->symbols().size(), 1);
|
||||
@@ -169,7 +169,7 @@ void tst_Lookup::simple_class_1()
|
||||
const LookupContext context(doc, snapshot);
|
||||
|
||||
// check class resolving:
|
||||
ClassOrNamespace *klass = context.lookupType(impl->name(), impl->scope());
|
||||
ClassOrNamespace *klass = context.lookupType(impl->name(), impl->enclosingScope());
|
||||
QVERIFY(klass != 0);
|
||||
QCOMPARE(klass->symbols().size(), 2);
|
||||
QVERIFY(klass->symbols().contains(iface));
|
||||
@@ -233,7 +233,7 @@ void tst_Lookup::class_with_baseclass()
|
||||
|
||||
const LookupContext context(doc, snapshot);
|
||||
|
||||
ClassOrNamespace *objClass = context.lookupType(baseZoo->name(), zooImpl->scope());
|
||||
ClassOrNamespace *objClass = context.lookupType(baseZoo->name(), zooImpl->enclosingScope());
|
||||
QVERIFY(objClass != 0);
|
||||
QVERIFY(objClass->symbols().contains(baseZoo));
|
||||
|
||||
@@ -286,13 +286,13 @@ void tst_Lookup::class_with_protocol_with_protocol()
|
||||
const LookupContext context(doc, snapshot);
|
||||
|
||||
{
|
||||
const QList<LookupItem> candidates = context.lookup(P1->name(), zooImpl->scope());
|
||||
const QList<LookupItem> candidates = context.lookup(P1->name(), zooImpl->enclosingScope());
|
||||
QCOMPARE(candidates.size(), 1);
|
||||
QVERIFY(candidates.at(0).declaration() == P1);
|
||||
}
|
||||
|
||||
{
|
||||
const QList<LookupItem> candidates = context.lookup(P2->protocolAt(0)->name(), zooImpl->scope());
|
||||
const QList<LookupItem> candidates = context.lookup(P2->protocolAt(0)->name(), zooImpl->enclosingScope());
|
||||
QCOMPARE(candidates.size(), 1);
|
||||
QVERIFY(candidates.first().declaration() == P1);
|
||||
}
|
||||
@@ -354,7 +354,7 @@ void tst_Lookup::iface_impl_scoping()
|
||||
QCOMPARE(arg->name()->identifier()->chars(), "arg");
|
||||
QVERIFY(arg->type()->isIntegerType());
|
||||
|
||||
const QList<LookupItem> candidates = context.lookup(arg->name(), method1Body->scope());
|
||||
const QList<LookupItem> candidates = context.lookup(arg->name(), method1Body->enclosingScope());
|
||||
QCOMPARE(candidates.size(), 1);
|
||||
QVERIFY(candidates.at(0).declaration()->type()->asIntegerType());
|
||||
}
|
||||
@@ -364,7 +364,7 @@ void tst_Lookup::iface_impl_scoping()
|
||||
QCOMPARE(method2->identifier()->chars(), "method2");
|
||||
|
||||
{ // verify if we can resolve "method2" in the body
|
||||
const QList<LookupItem> candidates = context.lookup(method2->name(), method1Body->scope());
|
||||
const QList<LookupItem> candidates = context.lookup(method2->name(), method1Body->enclosingScope());
|
||||
QCOMPARE(candidates.size(), 1);
|
||||
QCOMPARE(candidates.at(0).declaration(), method2);
|
||||
}
|
||||
|
||||
@@ -414,10 +414,10 @@ void tst_Semantic::pointer_to_function_1()
|
||||
QVERIFY(funTy);
|
||||
|
||||
QEXPECT_FAIL("", "Requires initialize enclosing scope of pointer-to-function symbols", Continue);
|
||||
QVERIFY(funTy->scope());
|
||||
QVERIFY(funTy->enclosingScope());
|
||||
|
||||
QEXPECT_FAIL("", "Requires initialize enclosing scope of pointer-to-function symbols", Continue);
|
||||
QCOMPARE(funTy->scope(), decl->scope());
|
||||
QCOMPARE(funTy->enclosingScope(), decl->enclosingScope());
|
||||
}
|
||||
|
||||
void tst_Semantic::template_instance_1()
|
||||
|
||||
@@ -50,14 +50,14 @@ struct V: public ASTVisitor
|
||||
virtual bool visit(FunctionDeclaratorAST *ast)
|
||||
{
|
||||
if (ast->as_cpp_initializer) {
|
||||
if (! (ast->symbol && ast->symbol->scope()))
|
||||
; //translationUnit()->warning(ast->firstToken(), "resolved as function declaration");
|
||||
else if (ast->symbol->scope()->isNamespace() || ast->symbol->scope()->isTemplate())
|
||||
; //translationUnit()->warning(ast->firstToken(), "resolved as function declaration");
|
||||
else if (ast->symbol->scope()->isBlock())
|
||||
; //translationUnit()->warning(ast->firstToken(), "resolved as C++ initializer");
|
||||
if (! (ast->symbol && ast->symbol->enclosingScope()))
|
||||
; //translationUnit()->warning(ast->firstToken(), "resolved as function declaration");
|
||||
else if (ast->symbol->enclosingScope()->isNamespace() || ast->symbol->enclosingScope()->isTemplate())
|
||||
; //translationUnit()->warning(ast->firstToken(), "resolved as function declaration");
|
||||
else if (ast->symbol->enclosingScope()->isBlock())
|
||||
; //translationUnit()->warning(ast->firstToken(), "resolved as C++ initializer");
|
||||
else
|
||||
translationUnit()->warning(ast->firstToken(), "ambiguous function declarator or C++ intializer");
|
||||
translationUnit()->warning(ast->firstToken(), "ambiguous function declarator or C++ intializer");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user