Commit 9ceabbac authored by Nicolas Arnaud-Cormos's avatar Nicolas Arnaud-Cormos Committed by Christian Kamm
Browse files

Create definition is available on the whole declaration line.



Merge-request: 390
Reviewed-by: default avatarChristian Kamm <christian.d.kamm@nokia.com>

Change-Id: I046b3046d3d0148b0fad694181f17737e12a85b6
Reviewed-on: http://codereview.qt-project.org/5529

Reviewed-by: default avatarChristian Kamm <christian.d.kamm@nokia.com>
parent 9357b054
...@@ -293,7 +293,6 @@ QList<CppQuickFixOperation::Ptr> DefFromDecl::match( ...@@ -293,7 +293,6 @@ QList<CppQuickFixOperation::Ptr> DefFromDecl::match(
const QSharedPointer<const Internal::CppQuickFixAssistInterface> &interface) const QSharedPointer<const Internal::CppQuickFixAssistInterface> &interface)
{ {
const QList<AST *> &path = interface->path(); const QList<AST *> &path = interface->path();
CppRefactoringFilePtr file = interface->currentFile();
int idx = path.size() - 1; int idx = path.size() - 1;
for (; idx >= 0; --idx) { for (; idx >= 0; --idx) {
...@@ -306,17 +305,14 @@ QList<CppQuickFixOperation::Ptr> DefFromDecl::match( ...@@ -306,17 +305,14 @@ QList<CppQuickFixOperation::Ptr> DefFromDecl::match(
&& !decl->type()->asFunctionType()->isPureVirtual() && !decl->type()->asFunctionType()->isPureVirtual()
&& decl->enclosingScope() && decl->enclosingScope()
&& decl->enclosingScope()->isClass()) { && decl->enclosingScope()->isClass()) {
DeclaratorAST *declarator = simpleDecl->declarator_list->value; CppRefactoringChanges refactoring(interface->snapshot());
if (file->isCursorOn(declarator->core_declarator)) { InsertionPointLocator locator(refactoring);
CppRefactoringChanges refactoring(interface->snapshot()); QList<CppQuickFixOperation::Ptr> results;
InsertionPointLocator locator(refactoring); foreach (const InsertionLocation &loc, locator.methodDefinition(decl)) {
QList<CppQuickFixOperation::Ptr> results; if (loc.isValid())
foreach (const InsertionLocation &loc, locator.methodDefinition(decl)) { results.append(CppQuickFixOperation::Ptr(new InsertDefOperation(interface, idx, decl, loc)));
if (loc.isValid())
results.append(CppQuickFixOperation::Ptr(new InsertDefOperation(interface, idx, decl, loc)));
}
return results;
} }
return results;
} }
} }
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment