Skip to content
GitLab
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
8d5dde66
Commit
8d5dde66
authored
May 20, 2010
by
Erik Verbruggen
Browse files
Fixed qualified name creation for ObjC classes and protocols.
Also fixed the tests for it.
parent
7f4cbe23
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/libs/cplusplus/LookupContext.cpp
View file @
8d5dde66
...
...
@@ -63,9 +63,11 @@ static void fullyQualifiedName_helper(Symbol *symbol, QList<const Name *> *names
}
else
if
(
symbol
->
name
()
->
isNameId
()
||
symbol
->
name
()
->
isTemplateNameId
())
{
names
->
append
(
symbol
->
name
());
}
}
else
if
(
symbol
->
isObjCClass
()
||
symbol
->
isObjCBaseClass
()
||
symbol
->
isObjCProtocol
()
||
symbol
->
isObjCForwardClassDeclaration
()
||
symbol
->
isObjCForwardProtocolDeclaration
())
{
if
(
symbol
->
name
())
names
->
append
(
symbol
->
name
());
}
else
if
(
symbol
->
isFunction
())
{
if
(
const
QualifiedNameId
*
q
=
symbol
->
name
()
->
asQualifiedNameId
())
{
for
(
unsigned
i
=
0
;
i
<
q
->
nameCount
()
-
1
;
++
i
)
...
...
@@ -73,7 +75,6 @@ static void fullyQualifiedName_helper(Symbol *symbol, QList<const Name *> *names
}
}
}
}
bool
ClassOrNamespace
::
CompareName
::
operator
()(
const
Name
*
name
,
const
Name
*
other
)
const
...
...
tests/auto/cplusplus/lookup/tst_lookup.cpp
View file @
8d5dde66
...
...
@@ -144,10 +144,15 @@ void tst_Lookup::simple_class_1()
QVERIFY
(
!
impl
->
isInterface
());
QCOMPARE
(
impl
->
memberCount
(),
3U
);
ObjCMethod
*
allocMethod
=
impl
->
memberAt
(
0
)
->
asObjCMethod
();
QVERIFY
(
allocMethod
);
QVERIFY
(
allocMethod
->
name
()
&&
allocMethod
->
name
()
->
identifier
());
QCOMPARE
(
QLatin1String
(
allocMethod
->
name
()
->
identifier
()
->
chars
()),
QLatin1String
(
"alloc"
));
Declaration
*
allocMethodIface
=
iface
->
memberAt
(
0
)
->
asDeclaration
();
QVERIFY
(
allocMethodIface
);
QVERIFY
(
allocMethodIface
->
name
()
&&
allocMethodIface
->
name
()
->
identifier
());
QCOMPARE
(
QLatin1String
(
allocMethodIface
->
name
()
->
identifier
()
->
chars
()),
QLatin1String
(
"alloc"
));
ObjCMethod
*
allocMethodImpl
=
impl
->
memberAt
(
0
)
->
asObjCMethod
();
QVERIFY
(
allocMethodImpl
);
QVERIFY
(
allocMethodImpl
->
name
()
&&
allocMethodImpl
->
name
()
->
identifier
());
QCOMPARE
(
QLatin1String
(
allocMethodImpl
->
name
()
->
identifier
()
->
chars
()),
QLatin1String
(
"alloc"
));
ObjCMethod
*
deallocMethod
=
impl
->
memberAt
(
2
)
->
asObjCMethod
();
QVERIFY
(
deallocMethod
);
...
...
@@ -164,12 +169,12 @@ void tst_Lookup::simple_class_1()
QVERIFY
(
klass
->
symbols
().
contains
(
impl
));
// check method resolving:
QList
<
Symbol
*>
results
=
context
.
lookup
(
allocMethod
->
name
(),
impl
->
scope
());
QList
<
Symbol
*>
results
=
context
.
lookup
(
allocMethod
Impl
->
name
(),
impl
->
members
());
QCOMPARE
(
results
.
size
(),
2
);
QCOMPARE
(
results
.
at
(
0
),
allocMethod
);
QCOMPARE
(
results
.
at
(
1
),
allocMethod
);
QCOMPARE
(
results
.
at
(
0
),
allocMethod
Iface
);
QCOMPARE
(
results
.
at
(
1
),
allocMethod
Impl
);
results
=
context
.
lookup
(
deallocMethod
->
name
(),
impl
->
scope
());
results
=
context
.
lookup
(
deallocMethod
->
name
(),
impl
->
members
());
QCOMPARE
(
results
.
size
(),
1
);
QCOMPARE
(
results
.
at
(
0
),
deallocMethod
);
}
...
...
@@ -225,11 +230,11 @@ void tst_Lookup::class_with_baseclass()
QVERIFY
(
objClass
!=
0
);
QVERIFY
(
objClass
->
symbols
().
contains
(
baseZoo
));
QList
<
Symbol
*>
results
=
context
.
lookup
(
baseDecl
->
name
(),
zooImpl
->
scope
());
QList
<
Symbol
*>
results
=
context
.
lookup
(
baseDecl
->
name
(),
zooImpl
->
members
());
QCOMPARE
(
results
.
size
(),
1
);
QCOMPARE
(
results
.
at
(
0
),
baseDecl
);
results
=
context
.
lookup
(
baseMethod
->
name
(),
zooImpl
->
scope
());
results
=
context
.
lookup
(
baseMethod
->
name
(),
zooImpl
->
members
());
QCOMPARE
(
results
.
size
(),
1
);
QCOMPARE
(
results
.
at
(
0
),
baseMethod
);
}
...
...
@@ -285,7 +290,7 @@ void tst_Lookup::class_with_protocol_with_protocol()
QVERIFY
(
candidates
.
contains
(
P1
));
}
QList
<
Symbol
*>
results
=
context
.
lookup
(
p1method
->
name
(),
zooImpl
->
scope
());
QList
<
Symbol
*>
results
=
context
.
lookup
(
p1method
->
name
(),
zooImpl
->
members
());
QCOMPARE
(
results
.
size
(),
1
);
QCOMPARE
(
results
.
at
(
0
),
p1method
);
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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