forked from qt-creator/qt-creator
Use Prototype instead of Function.
This commit is contained in:
committed by
Oswald Buddenhagen
parent
9aa991d636
commit
4ff3ee2ff0
@@ -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();
|
Function *fun = scope->owner()->asFunction();
|
||||||
bindings()->lookupInScope(name, fun->members(), &candidates, /*templateId = */ 0, /*binding=*/ 0);
|
bindings()->lookupInScope(name, fun->members(), &candidates, /*templateId = */ 0, /*binding=*/ 0);
|
||||||
|
|
||||||
|
|||||||
@@ -316,7 +316,7 @@ void ResolveExpression::thisObject()
|
|||||||
{
|
{
|
||||||
Scope *scope = _scope;
|
Scope *scope = _scope;
|
||||||
for (; scope; scope = scope->enclosingScope()) {
|
for (; scope; scope = scope->enclosingScope()) {
|
||||||
if (scope->isFunctionScope()) {
|
if (scope->isPrototypeScope()) {
|
||||||
Function *fun = scope->owner()->asFunction();
|
Function *fun = scope->owner()->asFunction();
|
||||||
if (Scope *cscope = scope->enclosingClassScope()) {
|
if (Scope *cscope = scope->enclosingClassScope()) {
|
||||||
Class *klass = cscope->owner()->asClass();
|
Class *klass = cscope->owner()->asClass();
|
||||||
|
|||||||
@@ -1078,10 +1078,10 @@ void CPPEditor::switchDeclarationDefinition()
|
|||||||
Symbol *lastVisibleSymbol = thisDocument->lastVisibleSymbolAt(line, column);
|
Symbol *lastVisibleSymbol = thisDocument->lastVisibleSymbolAt(line, column);
|
||||||
|
|
||||||
Scope *functionScope = 0;
|
Scope *functionScope = 0;
|
||||||
if (scope->isFunctionScope())
|
if (scope->isPrototypeScope())
|
||||||
functionScope = scope;
|
functionScope = scope;
|
||||||
else
|
else
|
||||||
functionScope = scope->enclosingFunctionScope();
|
functionScope = scope->enclosingPrototypeScope();
|
||||||
|
|
||||||
if (! functionScope && lastVisibleSymbol) {
|
if (! functionScope && lastVisibleSymbol) {
|
||||||
if (Function *def = lastVisibleSymbol->asFunction())
|
if (Function *def = lastVisibleSymbol->asFunction())
|
||||||
|
|||||||
@@ -130,7 +130,7 @@ protected:
|
|||||||
Scope *scope = _doc->scopeAt(line, column);
|
Scope *scope = _doc->scopeAt(line, column);
|
||||||
|
|
||||||
while (scope) {
|
while (scope) {
|
||||||
if (scope->isFunctionScope()) {
|
if (scope->isPrototypeScope()) {
|
||||||
Function *fun = scope->owner()->asFunction();
|
Function *fun = scope->owner()->asFunction();
|
||||||
if (findMember(fun->members(), ast, line, column))
|
if (findMember(fun->members(), ast, line, column))
|
||||||
return false;
|
return false;
|
||||||
@@ -176,7 +176,7 @@ protected:
|
|||||||
Scope *scope = _doc->scopeAt(line, column);
|
Scope *scope = _doc->scopeAt(line, column);
|
||||||
|
|
||||||
while (scope) {
|
while (scope) {
|
||||||
if (scope->isFunctionScope()) {
|
if (scope->isPrototypeScope()) {
|
||||||
Function *fun = scope->owner()->asFunction();
|
Function *fun = scope->owner()->asFunction();
|
||||||
if (findMember(fun->members(), ast, line, column))
|
if (findMember(fun->members(), ast, line, column))
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -68,7 +68,7 @@ QString AbstractEditorSupport::functionAt(const CppModelManagerInterface *modelM
|
|||||||
return QString();
|
return QString();
|
||||||
if (const CPlusPlus::Symbol *symbol = document->lastVisibleSymbolAt(line, column))
|
if (const CPlusPlus::Symbol *symbol = document->lastVisibleSymbolAt(line, column))
|
||||||
if (const CPlusPlus::Scope *scope = symbol->scope())
|
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()) {
|
if (const CPlusPlus::Symbol *function = functionScope->owner()) {
|
||||||
const CPlusPlus::Overview o;
|
const CPlusPlus::Overview o;
|
||||||
QString rc = o.prettyName(function->name());
|
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());
|
currentBinding = context.lookupType(scope->owner());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -1079,7 +1079,7 @@ void CppCodeCompletion::globalCompletion(Scope *currentScope)
|
|||||||
for (unsigned i = 0; i < scope->symbolCount(); ++i) {
|
for (unsigned i = 0; i < scope->symbolCount(); ++i) {
|
||||||
addCompletionItem(scope->symbolAt(i));
|
addCompletionItem(scope->symbolAt(i));
|
||||||
}
|
}
|
||||||
} else if (scope->isFunctionScope()) {
|
} else if (scope->isPrototypeScope()) {
|
||||||
Function *fun = scope->owner()->asFunction();
|
Function *fun = scope->owner()->asFunction();
|
||||||
for (unsigned i = 0; i < fun->argumentCount(); ++i) {
|
for (unsigned i = 0; i < fun->argumentCount(); ++i) {
|
||||||
addCompletionItem(fun->argumentAt(i));
|
addCompletionItem(fun->argumentAt(i));
|
||||||
|
|||||||
@@ -120,7 +120,7 @@ QDebug operator<<(QDebug d, const Scope &scope)
|
|||||||
str << " enum";
|
str << " enum";
|
||||||
if (scope.isBlockScope())
|
if (scope.isBlockScope())
|
||||||
str << " block";
|
str << " block";
|
||||||
if (scope.isFunctionScope())
|
if (scope.isPrototypeScope())
|
||||||
str << " function";
|
str << " function";
|
||||||
if (scope.isPrototypeScope())
|
if (scope.isPrototypeScope())
|
||||||
str << " prototype";
|
str << " prototype";
|
||||||
@@ -374,7 +374,7 @@ int getUninitializedVariablesI(const CPlusPlus::Snapshot &snapshot,
|
|||||||
if (CPlusPlus::Block *block = function->memberAt(0)->asBlock())
|
if (CPlusPlus::Block *block = function->memberAt(0)->asBlock())
|
||||||
innerMostScope = block->members();
|
innerMostScope = block->members();
|
||||||
} else {
|
} else {
|
||||||
if (const CPlusPlus::Scope *functionScope = symbolAtLine->enclosingFunctionScope()) {
|
if (const CPlusPlus::Scope *functionScope = symbolAtLine->enclosingPrototypeScope()) {
|
||||||
function = functionScope->owner()->asFunction();
|
function = functionScope->owner()->asFunction();
|
||||||
innerMostScope = symbolAtLine->isBlock() ?
|
innerMostScope = symbolAtLine->isBlock() ?
|
||||||
symbolAtLine->asBlock()->members() :
|
symbolAtLine->asBlock()->members() :
|
||||||
|
|||||||
@@ -118,7 +118,7 @@ Scope *Scope::enclosingEnumScope() const
|
|||||||
return scope;
|
return scope;
|
||||||
}
|
}
|
||||||
|
|
||||||
Scope *Scope::enclosingFunctionScope() const
|
Scope *Scope::enclosingPrototypeScope() const
|
||||||
{
|
{
|
||||||
Scope *scope = enclosingScope();
|
Scope *scope = enclosingScope();
|
||||||
for (; scope; scope = scope->enclosingScope()) {
|
for (; scope; scope = scope->enclosingScope()) {
|
||||||
@@ -166,11 +166,6 @@ bool Scope::isBlockScope() const
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Scope::isPrototypeScope() const
|
|
||||||
{
|
|
||||||
return isFunctionScope();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool Scope::isObjCClassScope() const
|
bool Scope::isObjCClassScope() const
|
||||||
{
|
{
|
||||||
if (_owner)
|
if (_owner)
|
||||||
@@ -185,7 +180,7 @@ bool Scope::isObjCProtocolScope() const
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Scope::isFunctionScope() const
|
bool Scope::isPrototypeScope() const
|
||||||
{
|
{
|
||||||
if (_owner)
|
if (_owner)
|
||||||
return _owner->isFunction();
|
return _owner->isFunction();
|
||||||
|
|||||||
@@ -87,8 +87,8 @@ public:
|
|||||||
/// Returns the enclosing enum scope.
|
/// Returns the enclosing enum scope.
|
||||||
Scope *enclosingEnumScope() const;
|
Scope *enclosingEnumScope() const;
|
||||||
|
|
||||||
/// Rerturns the enclosing function scope.
|
/// Rerturns the enclosing prototype scope.
|
||||||
Scope *enclosingFunctionScope() const;
|
Scope *enclosingPrototypeScope() const;
|
||||||
|
|
||||||
/// Rerturns the enclosing Block scope.
|
/// Rerturns the enclosing Block scope.
|
||||||
Scope *enclosingBlockScope() const;
|
Scope *enclosingBlockScope() const;
|
||||||
@@ -105,9 +105,6 @@ public:
|
|||||||
/// Returns true if this scope's owner is a Block Symbol.
|
/// Returns true if this scope's owner is a Block Symbol.
|
||||||
bool isBlockScope() const;
|
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.
|
/// Returns true if this scope's owner is a Prototype Symbol.
|
||||||
bool isPrototypeScope() const;
|
bool isPrototypeScope() const;
|
||||||
|
|
||||||
|
|||||||
@@ -283,15 +283,15 @@ Scope *Symbol::enclosingEnumScope() const
|
|||||||
return _scope->enclosingEnumScope();
|
return _scope->enclosingEnumScope();
|
||||||
}
|
}
|
||||||
|
|
||||||
Scope *Symbol::enclosingFunctionScope() const
|
Scope *Symbol::enclosingPrototypeScope() const
|
||||||
{
|
{
|
||||||
if (! _scope)
|
if (! _scope)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
else if (_scope->isFunctionScope())
|
else if (_scope->isPrototypeScope())
|
||||||
return _scope;
|
return _scope;
|
||||||
|
|
||||||
return _scope->enclosingFunctionScope();
|
return _scope->enclosingPrototypeScope();
|
||||||
}
|
}
|
||||||
|
|
||||||
Scope *Symbol::enclosingBlockScope() const
|
Scope *Symbol::enclosingBlockScope() const
|
||||||
|
|||||||
@@ -295,8 +295,8 @@ public:
|
|||||||
/// Returns the enclosing enum scope.
|
/// Returns the enclosing enum scope.
|
||||||
Scope *enclosingEnumScope() const;
|
Scope *enclosingEnumScope() const;
|
||||||
|
|
||||||
/// Returns the enclosing function scope.
|
/// Returns the enclosing prototype scope.
|
||||||
Scope *enclosingFunctionScope() const;
|
Scope *enclosingPrototypeScope() const;
|
||||||
|
|
||||||
/// Returns the enclosing Block scope.
|
/// Returns the enclosing Block scope.
|
||||||
Scope *enclosingBlockScope() const;
|
Scope *enclosingBlockScope() const;
|
||||||
|
|||||||
Reference in New Issue
Block a user