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
06c7cb9b
Commit
06c7cb9b
authored
Jul 12, 2010
by
Roberto Raggi
Browse files
Disable Create declaration from definition quickfix.
parent
adfdb516
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/libs/cplusplus/LookupContext.cpp
View file @
06c7cb9b
...
...
@@ -47,24 +47,24 @@ namespace {
using
namespace
CPlusPlus
;
static
void
addNames
(
const
Name
*
name
,
QList
<
const
Name
*>
*
names
)
static
void
addNames
(
const
Name
*
name
,
QList
<
const
Name
*>
*
names
,
bool
addAllNames
=
false
)
{
if
(
!
name
)
return
;
else
if
(
name
->
isNameId
()
||
name
->
isTemplateNameId
())
names
->
append
(
name
);
else
if
(
const
QualifiedNameId
*
q
=
name
->
asQualifiedNameId
())
{
addNames
(
q
->
base
(),
names
);
addNames
(
q
->
name
(),
names
);
}
else
if
(
addAllNames
||
name
->
isNameId
()
||
name
->
isTemplateNameId
())
{
names
->
append
(
name
);
}
}
static
void
fullyQualifiedName
_helper
(
Symbol
*
symbol
,
QList
<
const
Name
*>
*
names
)
static
void
path
_helper
(
Symbol
*
symbol
,
QList
<
const
Name
*>
*
names
)
{
if
(
!
symbol
)
return
;
fullyQualifiedName
_helper
(
symbol
->
enclosingSymbol
(),
names
);
path
_helper
(
symbol
->
enclosingSymbol
(),
names
);
if
(
symbol
->
name
())
{
if
(
symbol
->
isClass
()
||
symbol
->
isNamespace
())
{
...
...
@@ -137,14 +137,22 @@ LookupContext &LookupContext::operator = (const LookupContext &other)
}
QList
<
const
Name
*>
LookupContext
::
fullyQualifiedName
(
Symbol
*
symbol
)
{
QList
<
const
Name
*>
qualifiedName
=
path
(
symbol
->
enclosingSymbol
());
addNames
(
symbol
->
name
(),
&
qualifiedName
,
/*add all names*/
true
);
return
qualifiedName
;
}
QList
<
const
Name
*>
LookupContext
::
path
(
Symbol
*
symbol
)
{
QList
<
const
Name
*>
names
;
fullyQualifiedName
_helper
(
symbol
,
&
names
);
path
_helper
(
symbol
,
&
names
);
return
names
;
}
const
Name
*
LookupContext
::
minimalName
(
const
Name
*
name
,
Scope
*
s
ourc
e
,
Scope
*
s
cop
e
,
ClassOrNamespace
*
target
)
const
{
qWarning
()
<<
"TODO:"
<<
Q_FUNC_INFO
;
...
...
@@ -329,7 +337,7 @@ QList<Symbol *> LookupContext::lookup(const Name *name, Scope *scope) const
ClassOrNamespace
*
LookupContext
::
lookupParent
(
Symbol
*
symbol
)
const
{
QList
<
const
Name
*>
fqName
=
fullyQualifiedName
(
symbol
);
QList
<
const
Name
*>
fqName
=
path
(
symbol
);
ClassOrNamespace
*
binding
=
globalNamespace
();
foreach
(
const
Name
*
name
,
fqName
)
{
binding
=
binding
->
findType
(
name
);
...
...
@@ -697,15 +705,19 @@ ClassOrNamespace *CreateBindings::globalNamespace() const
ClassOrNamespace
*
CreateBindings
::
lookupType
(
Symbol
*
symbol
)
{
const
QList
<
const
Name
*>
names
=
LookupContext
::
fullyQualifiedName
(
symbol
);
const
QList
<
const
Name
*>
path
=
LookupContext
::
path
(
symbol
);
return
lookupType
(
path
);
}
if
(
names
.
isEmpty
())
ClassOrNamespace
*
CreateBindings
::
lookupType
(
const
QList
<
const
Name
*>
&
path
)
{
if
(
path
.
isEmpty
())
return
_globalNamespace
;
ClassOrNamespace
*
b
=
_globalNamespace
->
lookupType
(
names
.
at
(
0
));
ClassOrNamespace
*
b
=
_globalNamespace
->
lookupType
(
path
.
at
(
0
));
for
(
int
i
=
1
;
b
&&
i
<
names
.
size
();
++
i
)
b
=
b
->
findType
(
names
.
at
(
i
));
for
(
int
i
=
1
;
b
&&
i
<
path
.
size
();
++
i
)
b
=
b
->
findType
(
path
.
at
(
i
));
return
b
;
}
...
...
src/libs/cplusplus/LookupContext.h
View file @
06c7cb9b
...
...
@@ -125,6 +125,7 @@ public:
/// Finds the binding associated to the given symbol.
ClassOrNamespace
*
lookupType
(
Symbol
*
symbol
);
ClassOrNamespace
*
lookupType
(
const
QList
<
const
Name
*>
&
path
);
/// Returns the Control that must be used to create temporary symbols.
/// \internal
...
...
@@ -227,9 +228,10 @@ public:
QSharedPointer
<
Control
>
control
()
const
;
// ### deprecate
static
QList
<
const
Name
*>
fullyQualifiedName
(
Symbol
*
symbol
);
static
QList
<
const
Name
*>
path
(
Symbol
*
symbol
);
const
Name
*
minimalName
(
const
Name
*
name
,
Scope
*
source
,
ClassOrNamespace
*
target
)
const
;
Q_DECL_DEPRECATED
const
Name
*
minimalName
(
const
Name
*
name
,
Scope
*
source
,
ClassOrNamespace
*
target
)
const
;
private:
// The current expression.
...
...
src/plugins/cppeditor/cppquickfix.cpp
View file @
06c7cb9b
...
...
@@ -931,7 +931,7 @@ public:
// We need to do a QCA::translate, so we need a context.
// Use fully qualified class name:
Overview
oo
;
foreach
(
const
Name
*
n
,
LookupContext
::
fullyQualifiedName
(
function
))
{
foreach
(
const
Name
*
n
,
LookupContext
::
path
(
function
))
{
if
(
!
m_context
.
isEmpty
())
m_context
.
append
(
QLatin1String
(
"::"
));
m_context
.
append
(
oo
.
prettyName
(
n
));
...
...
@@ -1563,7 +1563,10 @@ QList<TextEditor::QuickFixOperation::Ptr> CppQuickFixFactory::quickFixOperations
quickFixOperations
.
append
(
convertNumericToOctal
);
quickFixOperations
.
append
(
convertNumericToDecimal
);
quickFixOperations
.
append
(
completeSwitchCaseStatement
);
#if 0
quickFixOperations.append(declFromDef);
#endif
if
(
editor
->
mimeType
()
==
CppTools
::
Constants
::
OBJECTIVE_CPP_SOURCE_MIMETYPE
)
quickFixOperations
.
append
(
wrapCString
);
...
...
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