Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Marco Bubke
flatpak-qt-creator
Commits
05f2fd66
Commit
05f2fd66
authored
Aug 26, 2010
by
Roberto Raggi
Browse files
Renamed Symbol::scope() to Symbol::enclosingScope().
parent
688d382a
Changes
21
Hide whitespace changes
Inline
Side-by-side
src/libs/cplusplus/CppDocument.cpp
View file @
05f2fd66
...
...
@@ -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
->
s
cope
());
const
QList
<
LookupItem
>
declarations
=
context
.
lookup
(
fun
->
name
(),
fun
->
enclosingS
cope
());
if
(
declarations
.
isEmpty
())
continue
;
...
...
src/libs/cplusplus/DeprecatedGenTemplateInstance.cpp
View file @
05f2fd66
...
...
@@ -129,7 +129,7 @@ private:
virtual
void
visit
(
Function
*
funTy
)
{
Function
*
fun
=
control
()
->
newFunction
(
/*sourceLocation=*/
0
,
funTy
->
name
());
fun
->
setScope
(
funTy
->
s
cope
());
fun
->
setScope
(
funTy
->
enclosingS
cope
());
fun
->
setConst
(
funTy
->
isConst
());
fun
->
setVolatile
(
funTy
->
isVolatile
());
fun
->
setVirtual
(
funTy
->
isVirtual
());
...
...
src/libs/cplusplus/FindUsages.cpp
View file @
05f2fd66
...
...
@@ -224,8 +224,8 @@ bool FindUsages::checkCandidates(const QList<LookupItem> &candidates) const
return
false
;
}
if
(
isLocalScope
(
_declSymbol
->
s
cope
())
||
isLocalScope
(
s
->
s
cope
()))
{
if
(
s
->
s
cope
()
!=
_declSymbol
->
s
cope
())
if
(
isLocalScope
(
_declSymbol
->
enclosingS
cope
())
||
isLocalScope
(
s
->
enclosingS
cope
()))
{
if
(
s
->
enclosingS
cope
()
!=
_declSymbol
->
enclosingS
cope
())
return
false
;
}
...
...
src/libs/cplusplus/Icons.cpp
View file @
05f2fd66
...
...
@@ -104,7 +104,7 @@ Icons::IconType Icons::iconTypeForSymbol(const Symbol *symbol)
}
else
if
(
symbol
->
isPrivate
())
{
return
FuncPrivateIconType
;
}
}
else
if
(
symbol
->
s
cope
()
&&
symbol
->
s
cope
()
->
isEnum
())
{
}
else
if
(
symbol
->
enclosingS
cope
()
&&
symbol
->
enclosingS
cope
()
->
isEnum
())
{
return
EnumeratorIconType
;
}
else
if
(
symbol
->
isDeclaration
()
||
symbol
->
isArgument
())
{
if
(
symbol
->
isPublic
())
{
...
...
src/libs/cplusplus/LookupContext.cpp
View file @
05f2fd66
...
...
@@ -68,7 +68,7 @@ static void path_helper(Symbol *symbol, QList<const Name *> *names)
if
(
!
symbol
)
return
;
path_helper
(
symbol
->
s
cope
(),
names
);
path_helper
(
symbol
->
enclosingS
cope
(),
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
->
s
cope
());
QList
<
const
Name
*>
qualifiedName
=
path
(
symbol
->
enclosingS
cope
());
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
->
s
cope
())
{
for
(;
scope
;
scope
=
scope
->
enclosingS
cope
())
{
if
((
name
->
isNameId
()
||
name
->
isTemplateNameId
())
&&
scope
->
isBlock
())
{
bindings
()
->
lookupInScope
(
name
,
scope
,
&
candidates
,
/*templateId = */
0
,
/*binding=*/
0
);
...
...
src/libs/cplusplus/LookupItem.cpp
View file @
05f2fd66
...
...
@@ -67,7 +67,7 @@ void LookupItem::setDeclaration(Symbol *declaration)
Scope
*
LookupItem
::
scope
()
const
{
if
(
!
_scope
&&
_declaration
)
return
_declaration
->
s
cope
();
return
_declaration
->
enclosingS
cope
();
return
_scope
;
}
...
...
src/libs/cplusplus/OverviewModel.cpp
View file @
05f2fd66
...
...
@@ -90,10 +90,10 @@ QModelIndex OverviewModel::parent(const QModelIndex &child) const
if
(
!
symbol
)
// account for no symbol item
return
QModelIndex
();
if
(
Scope
*
scope
=
symbol
->
s
cope
())
{
if
(
scope
->
s
cope
())
{
if
(
Scope
*
scope
=
symbol
->
enclosingS
cope
())
{
if
(
scope
->
enclosingS
cope
())
{
QModelIndex
index
;
if
(
scope
->
s
cope
()
&&
scope
->
scope
()
->
s
cope
())
// the parent doesn't have a parent
if
(
scope
->
enclosingS
cope
()
&&
scope
->
enclosingScope
()
->
enclosingS
cope
())
// 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
);
...
...
src/libs/cplusplus/ResolveExpression.cpp
View file @
05f2fd66
...
...
@@ -115,7 +115,7 @@ void ResolveExpression::addResults(const QList<Symbol *> &symbols)
foreach
(
Symbol
*
symbol
,
symbols
)
{
LookupItem
item
;
item
.
setType
(
symbol
->
type
());
item
.
setScope
(
symbol
->
s
cope
());
item
.
setScope
(
symbol
->
enclosingS
cope
());
item
.
setDeclaration
(
symbol
);
_results
.
append
(
item
);
}
...
...
@@ -313,18 +313,18 @@ bool ResolveExpression::visit(ThisExpressionAST *)
void
ResolveExpression
::
thisObject
()
{
Scope
*
scope
=
_scope
;
for
(;
scope
;
scope
=
scope
->
s
cope
())
{
for
(;
scope
;
scope
=
scope
->
enclosingS
cope
())
{
if
(
Function
*
fun
=
scope
->
asFunction
())
{
if
(
Class
*
klass
=
scope
->
enclosingClass
())
{
FullySpecifiedType
classTy
(
control
()
->
namedType
(
klass
->
name
()));
FullySpecifiedType
ptrTy
(
control
()
->
pointerType
(
classTy
));
addResult
(
ptrTy
,
fun
->
s
cope
());
addResult
(
ptrTy
,
fun
->
enclosingS
cope
());
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
->
s
cope
());
addResult
(
ptrTy
,
fun
->
enclosingS
cope
());
}
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
->
s
cope
()))
if
(
ClassOrNamespace
*
retBinding
=
findClass
(
ptrTy
->
elementType
(),
overload
->
enclosingS
cope
()))
return
retBinding
;
else
if
(
scope
!=
overload
->
s
cope
())
{
else
if
(
scope
!=
overload
->
enclosingS
cope
())
{
if
(
ClassOrNamespace
*
retBinding
=
findClass
(
ptrTy
->
elementType
(),
scope
))
return
retBinding
;
}
...
...
src/plugins/cppeditor/cppchecksymbols.cpp
View file @
05f2fd66
...
...
@@ -205,7 +205,7 @@ protected:
if
(
symbol
->
isTypedef
())
addType
(
symbol
->
name
());
else
if
(
!
symbol
->
type
()
->
isFunctionType
()
&&
symbol
->
s
cope
()
->
isClass
())
else
if
(
!
symbol
->
type
()
->
isFunctionType
()
&&
symbol
->
enclosingS
cope
()
->
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
->
s
cope
()),
declId
,
funTy
->
argumentCount
());
addVirtualMethod
(
_context
.
lookup
(
decl
->
name
(),
decl
->
enclosingS
cope
()),
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
->
s
cope
()),
declId
,
fun
->
argumentCount
());
addVirtualMethod
(
_context
.
lookup
(
fun
->
name
(),
fun
->
enclosingS
cope
()),
declId
,
fun
->
argumentCount
());
}
}
}
...
...
@@ -932,7 +932,7 @@ void CheckSymbols::addClassMember(const QList<LookupItem> &candidates, NameAST *
continue
;
else
if
(
!
c
->
isDeclaration
())
return
;
else
if
(
!
(
c
->
s
cope
()
&&
c
->
s
cope
()
->
isClass
()))
else
if
(
!
(
c
->
enclosingS
cope
()
&&
c
->
enclosingS
cope
()
->
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
->
s
cope
()
->
isEnum
())
{
if
(
c
->
enclosingS
cope
()
->
isEnum
())
{
unsigned
line
,
column
;
getTokenStartPosition
(
startToken
,
&
line
,
&
column
);
const
unsigned
length
=
tok
.
length
();
...
...
src/plugins/cppeditor/cppeditor.cpp
View file @
05f2fd66
...
...
@@ -346,10 +346,10 @@ struct CanonicalSymbol
const
LookupItem
&
r
=
results
.
at
(
i
);
Symbol
*
decl
=
r
.
declaration
();
if
(
!
(
decl
&&
decl
->
s
cope
()))
if
(
!
(
decl
&&
decl
->
enclosingS
cope
()))
break
;
if
(
Class
*
classScope
=
r
.
declaration
()
->
s
cope
()
->
asClass
())
{
if
(
Class
*
classScope
=
r
.
declaration
()
->
enclosingS
cope
()
->
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
->
s
cope
());
const
QList
<
LookupItem
>
declarations
=
context
.
lookup
(
functionDefinition
->
name
(),
functionDefinition
->
enclosingS
cope
());
foreach
(
const
LookupItem
&
r
,
declarations
)
{
Symbol
*
decl
=
r
.
declaration
();
// TODO: check decl.
...
...
src/plugins/cppeditor/cppelementevaluator.cpp
View file @
05f2fd66
...
...
@@ -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
->
s
cope
()
->
isEnum
())
{
}
else
if
(
declaration
->
isEnum
()
||
declaration
->
enclosingS
cope
()
->
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
->
s
cope
()
->
isClass
()
||
declaration
->
s
cope
()
->
isNamespace
()
||
declaration
->
s
cope
()
->
isEnum
())
{
if
(
declaration
->
enclosingS
cope
()
->
isClass
()
||
declaration
->
enclosingS
cope
()
->
isNamespace
()
||
declaration
->
enclosingS
cope
()
->
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
->
s
cope
()
->
isEnum
())
{
Symbol
*
enumSymbol
=
declaration
->
s
cope
()
->
asEnum
();
if
(
declaration
->
enclosingS
cope
()
->
isEnum
())
{
Symbol
*
enumSymbol
=
declaration
->
enclosingS
cope
()
->
asEnum
();
Overview
overview
;
setHelpMark
(
overview
.
prettyName
(
enumSymbol
->
name
()));
setTooltip
(
overview
.
prettyName
(
LookupContext
::
fullyQualifiedName
(
enumSymbol
)));
...
...
src/plugins/cppeditor/cpplocalsymbols.cpp
View file @
05f2fd66
...
...
@@ -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
->
s
cope
()
->
isFunction
()))
{
else
if
(
!
member
->
isGenerated
()
&&
(
member
->
sourceLocation
()
<
ast
->
firstToken
()
||
member
->
enclosingS
cope
()
->
isFunction
()))
{
unsigned
line
,
column
;
getTokenStartPosition
(
simpleName
->
identifier_token
,
&
line
,
&
column
);
localUses
[
member
].
append
(
SemanticInfo
::
Use
(
line
,
column
,
id
->
size
(),
SemanticInfo
::
Use
::
Local
));
...
...
src/plugins/cpptools/abstracteditorsupport.cpp
View file @
05f2fd66
...
...
@@ -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
->
s
cope
())
if
(
const
CPlusPlus
::
Scope
*
scope
=
symbol
->
enclosingS
cope
())
if
(
const
CPlusPlus
::
Scope
*
functionScope
=
scope
->
enclosingFunction
())
if
(
const
CPlusPlus
::
Symbol
*
function
=
functionScope
)
{
const
CPlusPlus
::
Overview
o
;
...
...
src/plugins/cpptools/cppcodecompletion.cpp
View file @
05f2fd66
...
...
@@ -1055,7 +1055,7 @@ void CppCodeCompletion::globalCompletion(Scope *currentScope)
QList
<
ClassOrNamespace
*>
usingBindings
;
ClassOrNamespace
*
currentBinding
=
0
;
for
(
Scope
*
scope
=
currentScope
;
scope
;
scope
=
scope
->
s
cope
())
{
for
(
Scope
*
scope
=
currentScope
;
scope
;
scope
=
scope
->
enclosingS
cope
())
{
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
->
s
cope
())
{
for
(
Scope
*
scope
=
currentScope
;
scope
;
scope
=
scope
->
enclosingS
cope
())
{
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
()
->
s
cope
()
!=
fun
->
s
cope
())
else
if
(
!
functions
.
isEmpty
()
&&
functions
.
first
()
->
enclosingS
cope
()
!=
fun
->
enclosingS
cope
())
continue
;
// skip fun, it's an hidden declaration.
bool
newOverload
=
true
;
...
...
src/plugins/cpptools/cppfindreferences.cpp
View file @
05f2fd66
...
...
@@ -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
->
s
cope
()
&&
!
symbol
->
isStatic
()
&&
symbol
->
s
cope
()
->
isNamespace
()))
{
if
(
symbol
->
isClass
()
||
symbol
->
isForwardClassDeclaration
()
||
(
symbol
->
enclosingS
cope
()
&&
!
symbol
->
isStatic
()
&&
symbol
->
enclosingS
cope
()
->
isNamespace
()))
{
foreach
(
const
Document
::
Ptr
&
doc
,
context
.
snapshot
())
{
if
(
doc
->
fileName
()
==
sourceFile
)
continue
;
...
...
src/shared/cplusplus/Scope.cpp
View file @
05f2fd66
...
...
@@ -143,7 +143,7 @@ void SymbolTable::enterSymbol(Symbol *symbol)
_symbols
=
reinterpret_cast
<
Symbol
**>
(
realloc
(
_symbols
,
sizeof
(
Symbol
*
)
*
_allocatedSymbols
));
}
assert
(
!
symbol
->
_scope
||
symbol
->
s
cope
()
==
_owner
);
assert
(
!
symbol
->
_scope
||
symbol
->
enclosingS
cope
()
==
_owner
);
symbol
->
_index
=
_symbolCount
;
symbol
->
_scope
=
_owner
;
_symbols
[
_symbolCount
]
=
symbol
;
...
...
src/shared/cplusplus/Symbol.cpp
View file @
05f2fd66
...
...
@@ -233,7 +233,7 @@ const Identifier *Symbol::identifier() const
return
0
;
}
Scope
*
Symbol
::
s
cope
()
const
Scope
*
Symbol
::
enclosingS
cope
()
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
->
s
cope
())
{
for
(
Scope
*
s
=
_scope
;
s
;
s
=
s
->
enclosingS
cope
())
{
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
->
s
cope
())
{
for
(
Scope
*
s
=
_scope
;
s
;
s
=
s
->
enclosingS
cope
())
{
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
->
s
cope
())
{
for
(
Scope
*
s
=
_scope
;
s
;
s
=
s
->
enclosingS
cope
())
{
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
->
s
cope
())
{
for
(
Scope
*
s
=
_scope
;
s
;
s
=
s
->
enclosingS
cope
())
{
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
->
s
cope
())
{
for
(
Scope
*
s
=
_scope
;
s
;
s
=
s
->
enclosingS
cope
())
{
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
->
s
cope
())
{
for
(
Scope
*
s
=
_scope
;
s
;
s
=
s
->
enclosingS
cope
())
{
if
(
Block
*
block
=
s
->
asBlock
())
return
block
;
}
...
...
src/shared/cplusplus/Symbol.h
View file @
05f2fd66
...
...
@@ -287,7 +287,7 @@ public:
void
setUnavailable
(
bool
isUnavailable
);
/// Returns this Symbol's eclosing scope.
Scope
*
s
cope
()
const
;
Scope
*
enclosingS
cope
()
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
*
s
cope
);
// ### make me private
void
setScope
(
Scope
*
enclosingS
cope
);
// ### make me private
void
setSourceLocation
(
unsigned
sourceLocation
,
TranslationUnit
*
translationUnit
);
// ### make me private
void
visitSymbol
(
SymbolVisitor
*
visitor
);
...
...
tests/auto/cplusplus/lookup/tst_lookup.cpp
View file @
05f2fd66
...
...
@@ -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
->
s
cope
());
ClassOrNamespace
*
klass
=
ctx
.
lookupType
(
derivedClass
->
baseClassAt
(
0
)
->
name
(),
derivedClass
->
enclosingS
cope
());
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
->
s
cope
());
ClassOrNamespace
*
klass
=
context
.
lookupType
(
impl
->
name
(),
impl
->
enclosingS
cope
());
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
->
s
cope
());
ClassOrNamespace
*
objClass
=
context
.
lookupType
(
baseZoo
->
name
(),
zooImpl
->
enclosingS
cope
());
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
->
s
cope
());
const
QList
<
LookupItem
>
candidates
=
context
.
lookup
(
P1
->
name
(),
zooImpl
->
enclosingS
cope
());
QCOMPARE
(
candidates
.
size
(),
1
);
QVERIFY
(
candidates
.
at
(
0
).
declaration
()
==
P1
);
}
{
const
QList
<
LookupItem
>
candidates
=
context
.
lookup
(
P2
->
protocolAt
(
0
)
->
name
(),
zooImpl
->
s
cope
());
const
QList
<
LookupItem
>
candidates
=
context
.
lookup
(
P2
->
protocolAt
(
0
)
->
name
(),
zooImpl
->
enclosingS
cope
());
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
->
s
cope
());
const
QList
<
LookupItem
>
candidates
=
context
.
lookup
(
arg
->
name
(),
method1Body
->
enclosingS
cope
());
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
->
s
cope
());
const
QList
<
LookupItem
>
candidates
=
context
.
lookup
(
method2
->
name
(),
method1Body
->
enclosingS
cope
());
QCOMPARE
(
candidates
.
size
(),
1
);
QCOMPARE
(
candidates
.
at
(
0
).
declaration
(),
method2
);
}
...
...
tests/auto/cplusplus/semantic/tst_semantic.cpp
View file @
05f2fd66
...
...
@@ -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
->
s
cope
());
QVERIFY
(
funTy
->
enclosingS
cope
());
QEXPECT_FAIL
(
""
,
"Requires initialize enclosing scope of pointer-to-function symbols"
,
Continue
);
QCOMPARE
(
funTy
->
s
cope
(),
decl
->
s
cope
());
QCOMPARE
(
funTy
->
enclosingS
cope
(),
decl
->
enclosingS
cope
());
}
void
tst_Semantic
::
template_instance_1
()
...
...
Prev
1
2
Next
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment