Commit 4ff3ee2f authored by Roberto Raggi's avatar Roberto Raggi Committed by Oswald Buddenhagen

Use Prototype instead of Function.

parent 9aa991d6
......@@ -280,7 +280,7 @@ QList<LookupItem> LookupContext::lookup(const Name *name, Scope *scope) const
}
}
} else if (scope->isFunctionScope()) {
} else if (scope->isPrototypeScope()) {
Function *fun = scope->owner()->asFunction();
bindings()->lookupInScope(name, fun->members(), &candidates, /*templateId = */ 0, /*binding=*/ 0);
......
......@@ -316,7 +316,7 @@ void ResolveExpression::thisObject()
{
Scope *scope = _scope;
for (; scope; scope = scope->enclosingScope()) {
if (scope->isFunctionScope()) {
if (scope->isPrototypeScope()) {
Function *fun = scope->owner()->asFunction();
if (Scope *cscope = scope->enclosingClassScope()) {
Class *klass = cscope->owner()->asClass();
......
......@@ -1078,10 +1078,10 @@ void CPPEditor::switchDeclarationDefinition()
Symbol *lastVisibleSymbol = thisDocument->lastVisibleSymbolAt(line, column);
Scope *functionScope = 0;
if (scope->isFunctionScope())
if (scope->isPrototypeScope())
functionScope = scope;
else
functionScope = scope->enclosingFunctionScope();
functionScope = scope->enclosingPrototypeScope();
if (! functionScope && lastVisibleSymbol) {
if (Function *def = lastVisibleSymbol->asFunction())
......
......@@ -130,7 +130,7 @@ protected:
Scope *scope = _doc->scopeAt(line, column);
while (scope) {
if (scope->isFunctionScope()) {
if (scope->isPrototypeScope()) {
Function *fun = scope->owner()->asFunction();
if (findMember(fun->members(), ast, line, column))
return false;
......@@ -176,7 +176,7 @@ protected:
Scope *scope = _doc->scopeAt(line, column);
while (scope) {
if (scope->isFunctionScope()) {
if (scope->isPrototypeScope()) {
Function *fun = scope->owner()->asFunction();
if (findMember(fun->members(), ast, line, column))
return false;
......
......@@ -68,7 +68,7 @@ QString AbstractEditorSupport::functionAt(const CppModelManagerInterface *modelM
return QString();
if (const CPlusPlus::Symbol *symbol = document->lastVisibleSymbolAt(line, column))
if (const CPlusPlus::Scope *scope = symbol->scope())
if (const CPlusPlus::Scope *functionScope = scope->enclosingFunctionScope())
if (const CPlusPlus::Scope *functionScope = scope->enclosingPrototypeScope())
if (const CPlusPlus::Symbol *function = functionScope->owner()) {
const CPlusPlus::Overview o;
QString rc = o.prettyName(function->name());
......
......@@ -1068,7 +1068,7 @@ void CppCodeCompletion::globalCompletion(Scope *currentScope)
}
}
}
} else if (scope->isFunctionScope() || scope->isClassScope() || scope->isNamespaceScope()) {
} else if (scope->isPrototypeScope() || scope->isClassScope() || scope->isNamespaceScope()) {
currentBinding = context.lookupType(scope->owner());
break;
}
......@@ -1079,7 +1079,7 @@ void CppCodeCompletion::globalCompletion(Scope *currentScope)
for (unsigned i = 0; i < scope->symbolCount(); ++i) {
addCompletionItem(scope->symbolAt(i));
}
} else if (scope->isFunctionScope()) {
} else if (scope->isPrototypeScope()) {
Function *fun = scope->owner()->asFunction();
for (unsigned i = 0; i < fun->argumentCount(); ++i) {
addCompletionItem(fun->argumentAt(i));
......
......@@ -120,7 +120,7 @@ QDebug operator<<(QDebug d, const Scope &scope)
str << " enum";
if (scope.isBlockScope())
str << " block";
if (scope.isFunctionScope())
if (scope.isPrototypeScope())
str << " function";
if (scope.isPrototypeScope())
str << " prototype";
......@@ -374,7 +374,7 @@ int getUninitializedVariablesI(const CPlusPlus::Snapshot &snapshot,
if (CPlusPlus::Block *block = function->memberAt(0)->asBlock())
innerMostScope = block->members();
} else {
if (const CPlusPlus::Scope *functionScope = symbolAtLine->enclosingFunctionScope()) {
if (const CPlusPlus::Scope *functionScope = symbolAtLine->enclosingPrototypeScope()) {
function = functionScope->owner()->asFunction();
innerMostScope = symbolAtLine->isBlock() ?
symbolAtLine->asBlock()->members() :
......
......@@ -118,7 +118,7 @@ Scope *Scope::enclosingEnumScope() const
return scope;
}
Scope *Scope::enclosingFunctionScope() const
Scope *Scope::enclosingPrototypeScope() const
{
Scope *scope = enclosingScope();
for (; scope; scope = scope->enclosingScope()) {
......@@ -166,11 +166,6 @@ bool Scope::isBlockScope() const
return false;
}
bool Scope::isPrototypeScope() const
{
return isFunctionScope();
}
bool Scope::isObjCClassScope() const
{
if (_owner)
......@@ -185,7 +180,7 @@ bool Scope::isObjCProtocolScope() const
return false;
}
bool Scope::isFunctionScope() const
bool Scope::isPrototypeScope() const
{
if (_owner)
return _owner->isFunction();
......
......@@ -87,8 +87,8 @@ public:
/// Returns the enclosing enum scope.
Scope *enclosingEnumScope() const;
/// Rerturns the enclosing function scope.
Scope *enclosingFunctionScope() const;
/// Rerturns the enclosing prototype scope.
Scope *enclosingPrototypeScope() const;
/// Rerturns the enclosing Block scope.
Scope *enclosingBlockScope() const;
......@@ -105,9 +105,6 @@ public:
/// Returns true if this scope's owner is a Block Symbol.
bool isBlockScope() const;
/// Returns true if this scope's owner is a Function Symbol.
bool isFunctionScope() const;
/// Returns true if this scope's owner is a Prototype Symbol.
bool isPrototypeScope() const;
......
......@@ -283,15 +283,15 @@ Scope *Symbol::enclosingEnumScope() const
return _scope->enclosingEnumScope();
}
Scope *Symbol::enclosingFunctionScope() const
Scope *Symbol::enclosingPrototypeScope() const
{
if (! _scope)
return 0;
else if (_scope->isFunctionScope())
else if (_scope->isPrototypeScope())
return _scope;
return _scope->enclosingFunctionScope();
return _scope->enclosingPrototypeScope();
}
Scope *Symbol::enclosingBlockScope() const
......
......@@ -295,8 +295,8 @@ public:
/// Returns the enclosing enum scope.
Scope *enclosingEnumScope() const;
/// Returns the enclosing function scope.
Scope *enclosingFunctionScope() const;
/// Returns the enclosing prototype scope.
Scope *enclosingPrototypeScope() const;
/// Returns the enclosing Block scope.
Scope *enclosingBlockScope() const;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment