Skip to content
Snippets Groups Projects
Commit 77942894 authored by Roberto Raggi's avatar Roberto Raggi
Browse files

Get rid of Oveview::prettyTypeWithName() and LookupContext::minimalName()

parent d3761d10
No related branches found
No related tags found
No related merge requests found
......@@ -150,24 +150,3 @@ QString Overview::prettyType(const FullySpecifiedType &ty,
return pp(ty, name);
}
/**
* Pretty-prints the given fully-specified type, but replacing the contained
* type with the given name.
*
* \param type the fully-specified type to convert to string
* \param the name for the named-type to use
* \param the control where the name is registered
* \return the pretty-printed name
*
* \todo Remove this method, and do it "for real" using the class CPlusPlus::Rewrite.
*/
QString Overview::prettyTypeWithName(const FullySpecifiedType &type,
const Name *name,
Control *control)
{
NamedType *namedTy = control->namedType(name);
FullySpecifiedType newTy = type;
newTy.setType(namedTy);
return prettyType(newTy);
}
......@@ -80,10 +80,6 @@ public:
QString prettyType(const FullySpecifiedType &type, const Name *name = 0) const;
QString prettyType(const FullySpecifiedType &type, const QString &name) const;
QString prettyTypeWithName(const FullySpecifiedType &type,
const Name *name,
Control *control);
private:
unsigned _markedArgument;
int _markedArgumentBegin;
......
......@@ -54,23 +54,6 @@ using CppEditor::CppRefactoringChanges;
namespace {
//! \todo This method should probably be changed when Overview#prettyTypeWithName is removed.
QString prettyMinimalType(const FullySpecifiedType &ty,
const LookupContext &context,
Scope *source,
ClassOrNamespace *target)
{
Overview oo;
if (const NamedType *namedTy = ty->asNamedType())
return oo.prettyTypeWithName(ty, context.minimalName(namedTy->name(),
source,
target),
context.control().data());
else
return oo(ty);
}
class Operation: public CppQuickFixOperation
{
public:
......@@ -103,7 +86,7 @@ public:
changes->changeFile(m_targetFileName, target);
changes->reindent(m_targetFileName,
Utils::ChangeSet::Range(targetPosition1, targetPosition2));
Utils::ChangeSet::Range(targetPosition2, targetPosition1));
changes->openEditor(m_targetFileName, loc.line(), loc.column());
}
......@@ -157,29 +140,16 @@ QString DeclFromDef::generateDeclaration(const CppQuickFixState &state,
Function *method,
ClassOrNamespace *targetBinding)
{
Q_UNUSED(targetBinding);
Overview oo;
QString decl;
oo.setShowFunctionSignatures(true);
oo.setShowReturnTypes(true);
oo.setShowArgumentNames(true);
decl.append(prettyMinimalType(method->returnType(),
state.context(),
method->scope(),
targetBinding));
decl.append(QLatin1Char(' '));
decl.append(QLatin1String(method->name()->identifier()->chars()));
decl.append(QLatin1Char('('));
for (unsigned argIdx = 0; argIdx < method->argumentCount(); ++argIdx) {
if (argIdx > 0)
decl.append(QLatin1String(", "));
Argument *arg = method->argumentAt(argIdx)->asArgument();
decl.append(prettyMinimalType(arg->type(),
state.context(),
method->members(),
targetBinding));
decl.append(QLatin1Char(' '));
decl.append(oo(arg->name()));
}
decl.append(QLatin1String(");\n\n"));
QString decl;
decl += oo(method->type(), method->identity());
decl += QLatin1String(";\n");
return decl;
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment