Merged ScopedSymbol and Scope.

This commit is contained in:
Roberto Raggi
2010-08-11 12:26:02 +02:00
parent 5accc9664e
commit 354b9712e4
33 changed files with 500 additions and 818 deletions

View File

@@ -246,8 +246,8 @@ public:
_declarationName = declarationName;
_functions = functions;
for (unsigned i = 0; i < globals->symbolCount(); ++i) {
accept(globals->symbolAt(i));
for (unsigned i = 0; i < globals->memberCount(); ++i) {
accept(globals->memberAt(i));
}
}
@@ -350,7 +350,7 @@ struct CanonicalSymbol
break;
else if (! r.declaration()->scope())
break;
else if (! r.declaration()->scope()->isClassScope())
else if (! r.declaration()->scope()->isClass())
break;
if (Function *funTy = r.declaration()->type()->asFunctionType())
@@ -1079,20 +1079,20 @@ void CPPEditor::switchDeclarationDefinition()
Symbol *lastVisibleSymbol = thisDocument->lastVisibleSymbolAt(line, column);
Scope *functionScope = 0;
if (scope->isPrototypeScope())
if (scope->isFunction())
functionScope = scope;
else
functionScope = scope->enclosingPrototypeScope();
functionScope = scope->enclosingFunction();
if (! functionScope && lastVisibleSymbol) {
if (Function *def = lastVisibleSymbol->asFunction())
functionScope = def->members();
functionScope = def;
}
if (functionScope) {
LookupContext context(thisDocument, snapshot);
Function *functionDefinition = functionScope->owner()->asFunction();
Function *functionDefinition = functionScope->asFunction();
const QList<LookupItem> declarations = context.lookup(functionDefinition->name(), functionDefinition->scope());
foreach (const LookupItem &r, declarations) {
Symbol *decl = r.declaration();