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
ed02e7ee
Commit
ed02e7ee
authored
May 28, 2009
by
Friedemann Kleint
Browse files
Merge branch 'master' of git@scm.dev.nokia.troll.no:creator/mainline
parents
f3612eba
a1ec4e2a
Changes
7
Hide whitespace changes
Inline
Side-by-side
src/libs/cplusplus/LookupContext.cpp
View file @
ed02e7ee
...
...
@@ -82,11 +82,11 @@ LookupContext::LookupContext(Control *control)
LookupContext
::
LookupContext
(
Symbol
*
symbol
,
Document
::
Ptr
expressionDocument
,
Document
::
Ptr
thisDocument
,
const
Snapshot
&
documents
)
const
Snapshot
&
snapshot
)
:
_symbol
(
symbol
),
_expressionDocument
(
expressionDocument
),
_thisDocument
(
thisDocument
),
_
documents
(
documents
)
_
snapshot
(
snapshot
)
{
_control
=
_expressionDocument
->
control
();
_visibleScopes
=
buildVisibleScopes
();
...
...
@@ -95,9 +95,6 @@ LookupContext::LookupContext(Symbol *symbol,
bool
LookupContext
::
isValid
()
const
{
return
_control
!=
0
;
}
LookupContext
::
operator
bool
()
const
{
return
_control
!=
0
;
}
Control
*
LookupContext
::
control
()
const
{
return
_control
;
}
...
...
@@ -111,20 +108,10 @@ Document::Ptr LookupContext::thisDocument() const
{
return
_thisDocument
;
}
Document
::
Ptr
LookupContext
::
document
(
const
QString
&
fileName
)
const
{
return
_
documents
.
value
(
fileName
);
}
{
return
_
snapshot
.
value
(
fileName
);
}
Identifier
*
LookupContext
::
identifier
(
Name
*
name
)
const
{
if
(
NameId
*
nameId
=
name
->
asNameId
())
return
nameId
->
identifier
();
else
if
(
TemplateNameId
*
templId
=
name
->
asTemplateNameId
())
return
templId
->
identifier
();
else
if
(
DestructorNameId
*
dtorId
=
name
->
asDestructorNameId
())
return
dtorId
->
identifier
();
else
if
(
QualifiedNameId
*
q
=
name
->
asQualifiedNameId
())
return
identifier
(
q
->
unqualifiedNameId
());
return
0
;
}
Snapshot
LookupContext
::
snapshot
()
const
{
return
_snapshot
;
}
bool
LookupContext
::
maybeValidSymbol
(
Symbol
*
symbol
,
ResolveMode
mode
,
...
...
@@ -257,6 +244,14 @@ QList<Symbol *> LookupContext::resolve(Name *name, const QList<Scope *> &visible
return
candidates
;
}
Identifier
*
LookupContext
::
identifier
(
const
Name
*
name
)
const
{
if
(
name
)
return
name
->
identifier
();
return
0
;
}
void
LookupContext
::
buildVisibleScopes_helper
(
Document
::
Ptr
doc
,
QList
<
Scope
*>
*
scopes
,
QSet
<
QString
>
*
processed
)
{
...
...
@@ -267,7 +262,7 @@ void LookupContext::buildVisibleScopes_helper(Document::Ptr doc, QList<Scope *>
scopes
->
append
(
doc
->
globalSymbols
());
foreach
(
const
Document
::
Include
&
incl
,
doc
->
includes
())
{
buildVisibleScopes_helper
(
_
documents
.
value
(
incl
.
fileName
()),
buildVisibleScopes_helper
(
_
snapshot
.
value
(
incl
.
fileName
()),
scopes
,
processed
);
}
}
...
...
src/libs/cplusplus/LookupContext.h
View file @
ed02e7ee
...
...
@@ -43,16 +43,16 @@ public:
LookupContext
(
Symbol
*
symbol
,
Document
::
Ptr
expressionDocument
,
Document
::
Ptr
thisDocument
,
const
Snapshot
&
documents
);
const
Snapshot
&
snapshot
);
bool
isValid
()
const
;
operator
bool
()
const
;
Control
*
control
()
const
;
Symbol
*
symbol
()
const
;
Document
::
Ptr
expressionDocument
()
const
;
Document
::
Ptr
thisDocument
()
const
;
Document
::
Ptr
document
(
const
QString
&
fileName
)
const
;
Snapshot
snapshot
()
const
;
QList
<
Symbol
*>
resolve
(
Name
*
name
)
const
{
return
resolve
(
name
,
visibleScopes
());
}
...
...
@@ -66,9 +66,6 @@ public:
QList
<
Symbol
*>
resolveClassOrNamespace
(
Name
*
name
)
const
{
return
resolveClassOrNamespace
(
name
,
visibleScopes
());
}
Snapshot
snapshot
()
const
{
return
_documents
;
}
enum
ResolveMode
{
ResolveSymbol
=
0x01
,
ResolveClass
=
0x02
,
...
...
@@ -77,8 +74,6 @@ public:
ResolveAll
=
ResolveSymbol
|
ResolveClassOrNamespace
};
Identifier
*
identifier
(
Name
*
name
)
const
;
QList
<
Symbol
*>
resolve
(
Name
*
name
,
const
QList
<
Scope
*>
&
visibleScopes
,
ResolveMode
mode
=
ResolveAll
)
const
;
...
...
@@ -120,6 +115,8 @@ public:
QList
<
Scope
*>
*
expandedScopes
)
const
;
private:
Identifier
*
identifier
(
const
Name
*
name
)
const
;
QList
<
Scope
*>
buildVisibleScopes
();
void
buildVisibleScopes_helper
(
Document
::
Ptr
doc
,
QList
<
Scope
*>
*
scopes
,
...
...
@@ -144,7 +141,7 @@ private:
Document
::
Ptr
_thisDocument
;
// All documents.
Snapshot
_
documents
;
Snapshot
_
snapshot
;
// Visible scopes.
QList
<
Scope
*>
_visibleScopes
;
...
...
src/shared/cplusplus/Name.h
View file @
ed02e7ee
...
...
@@ -63,6 +63,8 @@ public:
Name
();
virtual
~
Name
();
virtual
Identifier
*
identifier
()
const
=
0
;
bool
isNameId
()
const
;
bool
isTemplateNameId
()
const
;
bool
isDestructorNameId
()
const
;
...
...
src/shared/cplusplus/Names.cpp
View file @
ed02e7ee
...
...
@@ -73,6 +73,14 @@ QualifiedNameId::~QualifiedNameId()
void
QualifiedNameId
::
accept0
(
NameVisitor
*
visitor
)
{
visitor
->
visit
(
this
);
}
Identifier
*
QualifiedNameId
::
identifier
()
const
{
if
(
Name
*
u
=
unqualifiedNameId
())
return
u
->
identifier
();
return
0
;
}
unsigned
QualifiedNameId
::
nameCount
()
const
{
return
_nameCount
;
}
...
...
@@ -225,6 +233,9 @@ void OperatorNameId::accept0(NameVisitor *visitor)
int
OperatorNameId
::
kind
()
const
{
return
_kind
;
}
Identifier
*
OperatorNameId
::
identifier
()
const
{
return
0
;
}
bool
OperatorNameId
::
isEqualTo
(
const
Name
*
other
)
const
{
const
OperatorNameId
*
o
=
other
->
asOperatorNameId
();
...
...
@@ -246,6 +257,9 @@ void ConversionNameId::accept0(NameVisitor *visitor)
FullySpecifiedType
ConversionNameId
::
type
()
const
{
return
_type
;
}
Identifier
*
ConversionNameId
::
identifier
()
const
{
return
0
;
}
bool
ConversionNameId
::
isEqualTo
(
const
Name
*
other
)
const
{
const
ConversionNameId
*
c
=
other
->
asConversionNameId
();
...
...
src/shared/cplusplus/Names.h
View file @
ed02e7ee
...
...
@@ -64,6 +64,8 @@ public:
bool
isGlobal
=
false
);
virtual
~
QualifiedNameId
();
virtual
Identifier
*
identifier
()
const
;
unsigned
nameCount
()
const
;
Name
*
nameAt
(
unsigned
index
)
const
;
Name
*
const
*
names
()
const
;
...
...
@@ -94,7 +96,7 @@ public:
NameId
(
Identifier
*
identifier
);
virtual
~
NameId
();
Identifier
*
identifier
()
const
;
virtual
Identifier
*
identifier
()
const
;
virtual
bool
isEqualTo
(
const
Name
*
other
)
const
;
...
...
@@ -117,7 +119,7 @@ public:
DestructorNameId
(
Identifier
*
identifier
);
virtual
~
DestructorNameId
();
Identifier
*
identifier
()
const
;
virtual
Identifier
*
identifier
()
const
;
virtual
bool
isEqualTo
(
const
Name
*
other
)
const
;
...
...
@@ -142,7 +144,7 @@ public:
unsigned
templateArgumentCount
);
virtual
~
TemplateNameId
();
Identifier
*
identifier
()
const
;
virtual
Identifier
*
identifier
()
const
;
// ### find a better name
unsigned
templateArgumentCount
()
const
;
...
...
@@ -229,6 +231,7 @@ public:
int
kind
()
const
;
virtual
Identifier
*
identifier
()
const
;
virtual
bool
isEqualTo
(
const
Name
*
other
)
const
;
virtual
const
OperatorNameId
*
asOperatorNameId
()
const
...
...
@@ -252,6 +255,7 @@ public:
FullySpecifiedType
type
()
const
;
virtual
Identifier
*
identifier
()
const
;
virtual
bool
isEqualTo
(
const
Name
*
other
)
const
;
virtual
const
ConversionNameId
*
asConversionNameId
()
const
...
...
src/shared/cplusplus/Symbol.cpp
View file @
ed02e7ee
...
...
@@ -296,6 +296,14 @@ void Symbol::setName(Name *name)
}
}
Identifier
*
Symbol
::
identifier
()
const
{
if
(
_name
)
return
_name
->
identifier
();
return
0
;
}
Scope
*
Symbol
::
scope
()
const
{
return
_scope
;
}
...
...
src/shared/cplusplus/Symbol.h
View file @
ed02e7ee
...
...
@@ -125,6 +125,9 @@ public:
/// Sets this Symbol's name.
void
setName
(
Name
*
name
);
// ### dangerous
/// Returns this Symbol's (optional) identifier
Identifier
*
identifier
()
const
;
/// Returns this Symbol's storage class specifier.
int
storage
()
const
;
...
...
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